Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Distribution skeleton
  • Loading branch information
borodust committed Apr 15, 2017
1 parent 8a77603 commit 7d49cae
Show file tree
Hide file tree
Showing 12 changed files with 112 additions and 4 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Expand Up @@ -4,9 +4,10 @@
*.lisp-temp

# emacs junk
\#*
*~
.\#*

# build
build/

# system dependent junk
local/
Expand Down
Binary file added assets/font.brf
Binary file not shown.
1 change: 0 additions & 1 deletion main.lisp

This file was deleted.

4 changes: 4 additions & 0 deletions mortar-combat-devel.conf.lisp
@@ -0,0 +1,4 @@
'(:engine
(:systems (mortar-combat::mortar-combat)
:log-level :debug)
:assets "assets/")
15 changes: 14 additions & 1 deletion mortar-combat.asd
Expand Up @@ -9,7 +9,20 @@
:author "Pavel Korolev"
:mailto "dev@borodust.org"
:license "GPLv3"
:depends-on (log4cl bodge-blobs cl-bodge)
:depends-on (log4cl uiop cl-muth bodge-blobs cl-bodge)
:serial t
:pathname "src/"
:components ((:file "packages")
(:file "utils")
(:file "main")))


(defsystem mortar-combat/distrib
:description "Mortar Combat distribution"
:version "0.0.1"
:author "Pavel Korolev"
:mailto "dev@borodust.org"
:license "GPLv3"
:depends-on (bodge-blobs mortar-combat cl-bodge/distribution)
:serial t
:components ((:file "mortar-combat.dist")))
3 changes: 3 additions & 0 deletions mortar-combat.conf.lisp
@@ -0,0 +1,3 @@
'(:engine
(:systems (mortar-combat::mortar-combat))
:assets "assets/")
7 changes: 7 additions & 0 deletions mortar-combat.dist.lisp
@@ -0,0 +1,7 @@
(ge.dist:descriptor :mortar-combat
:base-directory "../"
:entry-function (:mortar-combat main)
:assets ("mortar-combat.conf.lisp"
"run.sh"
"run.bat"
"assets/"))
5 changes: 5 additions & 0 deletions run.bat
@@ -0,0 +1,5 @@
@echo off
set WORK_DIR=%~dp0
set PATH=%WORK_DIR%lib\;%PATH%

start /d "%WORK_DIR%" mortar-combat.bin mortar-combat.conf.lisp
16 changes: 16 additions & 0 deletions run.sh
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

WORK_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

case $OSTYPE in
linux*)
export LD_LIBRARY_PATH="$WORK_DIR/lib/"
export ALSOFT_DRIVERS="-jack,$ALSOFT_DRIVERS"
;;
darwin*)
export DYLD_LIBRARY_PATH="$WORK_DIR/lib/"
;;
esac

cd $WORK_DIR
./mortar-combat.bin mortar-combat.conf.lisp
55 changes: 55 additions & 0 deletions src/main.lisp
@@ -0,0 +1,55 @@
(in-package :mortar-combat)


(defvar *main-latch* (mt:make-latch))


(defclass mortar-combat (enableable generic-system)
((scene :initform nil))
(:default-initargs :depends-on '(graphics-system
physics-system
audio-system)))


(definline mortar-combat ()
(engine-system 'mortar-combat))


(defun scenegraph-flow ()
(scenegraph
(transform-node)))


(defmethod initialize-system :after ((this mortar-combat))
(with-slots (scene) this
(register-resource-loader (make-resource-loader (asset-path "font.brf")))
(run (>> (-> ((host)) ()
(setf (viewport-title) "Mortar Combat")
(setf (viewport-size) (vec2 800 600)))
(-> ((physics)) ()
(setf (gravity) (vec3 0.0 -9.81 0.0)))
(scenegraph-flow)
(instantly (scenegraph-root)
(setf scene (make-scene (make-pass-chain (make-simulation-pass)
(make-rendering-pass))
scenegraph-root)))
(concurrently ()
(let (looped-flow)
(setf looped-flow (>> (scene-processing-flow scene)
(instantly ()
(when (enabledp this)
(run looped-flow)))))
(run looped-flow)))))))


(defun start (configuration-path)
(startup configuration-path (uiop:pathname-directory-pathname configuration-path)))


(defun stop ()
(shutdown))


(defun main (args)
(start (merge-pathnames (second args) (uiop:getcwd)))
(mt:wait-for-latch *main-latch*))
File renamed without changes.
5 changes: 5 additions & 0 deletions src/utils.lisp
@@ -0,0 +1,5 @@
(in-package :mortar-combat)


(defun asset-path (file)
(merge-pathnames file (merge-working-pathname (property :assets "assets/"))))

0 comments on commit 7d49cae

Please sign in to comment.