diff options
| author | Gene Pasquet <dev@etenil.net> | 2026-04-05 15:34:21 +0100 |
|---|---|---|
| committer | Gene Pasquet <dev@etenil.net> | 2026-04-05 15:34:21 +0100 |
| commit | 2a75c88de470a173067feee4df80cd8e3fb7a641 (patch) | |
| tree | 65f6d158f635c82bf11c3b25a99f1404f3808fb4 | |
| parent | 526e6cdcdf1025d5e29680bc99ab910c79789764 (diff) | |
Cleanup and egg!
| -rw-r--r-- | .gitignore | 6 | ||||
| -rw-r--r-- | Makefile | 9 | ||||
| -rw-r--r-- | downstroke.egg | 23 | ||||
| -rw-r--r-- | entity.scm | 2 | ||||
| -rw-r--r-- | input.scm | 4 | ||||
| -rw-r--r-- | physics.scm | 8 | ||||
| -rw-r--r-- | renderer.scm | 8 | ||||
| -rw-r--r-- | tests/entity-test.scm | 2 | ||||
| -rw-r--r-- | tests/input-test.scm | 4 | ||||
| -rw-r--r-- | tests/physics-test.scm | 12 | ||||
| -rw-r--r-- | tests/renderer-test.scm | 10 | ||||
| -rw-r--r-- | tests/tilemap-test.scm | 2 | ||||
| -rw-r--r-- | tests/world-test.scm | 8 | ||||
| -rw-r--r-- | tilemap.scm | 2 | ||||
| -rw-r--r-- | world.scm | 6 |
15 files changed, 69 insertions, 37 deletions
@@ -2,8 +2,14 @@ .\#* *~ /bin/ +/downstroke/ *.import.scm +*.import.so +*.so *.o +*.link +*.build.sh +*.install.sh *.log logs /.agent-shell/ @@ -10,6 +10,9 @@ engine: $(OBJECT_FILES) bin: @mkdir -p $@ +downstroke: + @mkdir -p $@ + # Explicit inter-module dependencies bin/entity.o: bin/tilemap.o: @@ -19,9 +22,9 @@ bin/physics.o: bin/entity.o bin/world.o bin/tilemap.o bin/renderer.o: bin/entity.o bin/tilemap.o bin/world.o # Pattern rule: compile each module as a library unit -bin/%.o bin/%.import.scm: %.scm | bin - csc -c -J -unit $* $*.scm -o bin/$*.o -I bin - @if [ -f $*.import.scm ]; then mv $*.import.scm bin/; fi +bin/%.o: %.scm | bin downstroke + csc -c -J -unit downstroke/$* $*.scm -o bin/$*.o -I bin -L bin/downstroke + @mkdir -p bin/downstroke && if [ -f downstroke/$*.import.scm ]; then mv downstroke/$*.import.scm bin/downstroke/; fi .PHONY: clean test engine demos diff --git a/downstroke.egg b/downstroke.egg new file mode 100644 index 0000000..b28c79d --- /dev/null +++ b/downstroke.egg @@ -0,0 +1,23 @@ +((version "0.1.0") + (synopsis "2D tile-driven game engine for Chicken Scheme, built on SDL2") + (author "Gene Pasquet") + (license "MIT") + (category games) + (dependencies sdl2 sdl2-image sdl2-ttf expat defstruct srfi-1 srfi-13 srfi-197 matchable simple-logger) + (components + (extension downstroke/entity + (source "entity.scm")) + (extension downstroke/tilemap + (source "tilemap.scm")) + (extension downstroke/world + (source "world.scm") + (component-dependencies downstroke/entity downstroke/tilemap)) + (extension downstroke/physics + (source "physics.scm") + (component-dependencies downstroke/entity downstroke/tilemap downstroke/world)) + (extension downstroke/input + (source "input.scm") + (component-dependencies downstroke/entity)) + (extension downstroke/renderer + (source "renderer.scm") + (component-dependencies downstroke/entity downstroke/tilemap downstroke/world)))) @@ -1,4 +1,4 @@ -(module entity +(module downstroke/entity * (import scheme (chicken base) @@ -1,4 +1,4 @@ -(module input +(module downstroke/input * (import scheme @@ -9,7 +9,7 @@ (only srfi-197 chain) (prefix sdl2 sdl2:) simple-logger - entity + downstroke/entity defstruct) ;; Input configuration record diff --git a/physics.scm b/physics.scm index 83cc85b..68a96d6 100644 --- a/physics.scm +++ b/physics.scm @@ -1,12 +1,12 @@ -(module physics * +(module downstroke/physics * (import scheme (chicken base) (chicken keyword) (only srfi-1 fold iota) defstruct - tilemap - entity - world + downstroke/tilemap + downstroke/entity + downstroke/world simple-logger) ;; Gravity constant: pixels per frame per frame diff --git a/renderer.scm b/renderer.scm index ad894d0..e415394 100644 --- a/renderer.scm +++ b/renderer.scm @@ -1,13 +1,13 @@ -(module renderer +(module downstroke/renderer * (import scheme (chicken base) (only srfi-1 iota for-each) (prefix sdl2 "sdl2:") (prefix sdl2-ttf "ttf:") - entity - tilemap - world) + downstroke/entity + downstroke/tilemap + downstroke/world) ;; --- Pure functions (no SDL2, testable) --- diff --git a/tests/entity-test.scm b/tests/entity-test.scm index 3e1f85e..d67e0ff 100644 --- a/tests/entity-test.scm +++ b/tests/entity-test.scm @@ -1,6 +1,6 @@ (import srfi-64) (include "entity.scm") -(import entity) +(import downstroke/entity) (test-begin "entity") diff --git a/tests/input-test.scm b/tests/input-test.scm index 822875e..9153671 100644 --- a/tests/input-test.scm +++ b/tests/input-test.scm @@ -12,12 +12,12 @@ ;; Load entity first (input imports it) (include "entity.scm") -(import entity) +(import downstroke/entity) ;; Load the module source directly (include "input.scm") ;; Now import it to access the exported functions -(import input) +(import downstroke/input) ;; Test suite for input module (test-begin "input-module") diff --git a/tests/physics-test.scm b/tests/physics-test.scm index 4c6d4a6..0a2c92b 100644 --- a/tests/physics-test.scm +++ b/tests/physics-test.scm @@ -7,7 +7,7 @@ (only srfi-1 every member make-list fold iota)) ;; Create a mock tilemap module to avoid SDL dependency -(module tilemap * +(module downstroke/tilemap * (import scheme (chicken base) defstruct) (defstruct tileset @@ -35,23 +35,23 @@ layers objects)) -(import tilemap) +(import downstroke/tilemap) ;; Load entity module first (since world now imports entity) (include "entity.scm") -(import entity) +(import downstroke/entity) ;; Load world module first (include "world.scm") -(import world) +(import downstroke/world) ;; Load physics module (include "physics.scm") -(import physics) +(import downstroke/physics) ;; Load physics module (include "input.scm") -(import input) +(import downstroke/input) ;; Test suite for physics module (test-begin "physics-module") diff --git a/tests/renderer-test.scm b/tests/renderer-test.scm index a8fdeed..b771847 100644 --- a/tests/renderer-test.scm +++ b/tests/renderer-test.scm @@ -7,7 +7,7 @@ srfi-64) ;; Mock tilemap module -(module tilemap * +(module downstroke/tilemap * (import scheme (chicken base) defstruct) (defstruct tileset tilewidth tileheight spacing tilecount columns image-source image) (defstruct layer name width height map) @@ -15,7 +15,7 @@ (defstruct tile id rect) (define (tileset-tile ts id) (make-tile id: id rect: #f)) (define (tile-rect t) #f)) -(import tilemap) +(import downstroke/tilemap) ;; Mock sdl2 (module sdl2 * @@ -35,15 +35,15 @@ ;; Load entity module (include "entity.scm") -(import entity) +(import downstroke/entity) ;; Load world module (include "world.scm") -(import world) +(import downstroke/world) ;; Load renderer module (include "renderer.scm") -(import renderer) +(import downstroke/renderer) (test-begin "renderer") diff --git a/tests/tilemap-test.scm b/tests/tilemap-test.scm index a76cff9..47d6a51 100644 --- a/tests/tilemap-test.scm +++ b/tests/tilemap-test.scm @@ -20,7 +20,7 @@ ;; Load the module source directly (include "tilemap.scm") ;; Now import it to access the exported functions -(import tilemap) +(import downstroke/tilemap) ;; Test suite for tilemap module (test-begin "tilemap-module") diff --git a/tests/world-test.scm b/tests/world-test.scm index c758d2a..38005b2 100644 --- a/tests/world-test.scm +++ b/tests/world-test.scm @@ -7,7 +7,7 @@ (only srfi-1 every member make-list)) ;; Create a mock tilemap module to avoid SDL dependency -(module tilemap * +(module downstroke/tilemap * (import scheme (chicken base) defstruct) (defstruct tileset @@ -35,16 +35,16 @@ layers objects)) -(import tilemap) +(import downstroke/tilemap) ;; Load entity module first (since world now imports entity) (include "entity.scm") -(import entity) +(import downstroke/entity) ;; Load the module source directly (include "world.scm") ;; Now import it to access the exported functions -(import world) +(import downstroke/world) ;; Test suite for world module (test-begin "world-module") diff --git a/tilemap.scm b/tilemap.scm index 6e4dc95..7e9e11c 100644 --- a/tilemap.scm +++ b/tilemap.scm @@ -1,4 +1,4 @@ -(module tilemap +(module downstroke/tilemap * (import scheme (chicken io) @@ -1,11 +1,11 @@ -(module world +(module downstroke/world * (import scheme (chicken base) (only srfi-1 fold filter) defstruct - tilemap - entity) + downstroke/tilemap + downstroke/entity) ;; Scene = current level: tilemap (layers, objects) + list of entities. ;; Returns tile-id if the cell at (col, row) in this layer is non-zero, #f otherwise. |
