aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGene Pasquet <dev@etenil.net>2026-04-05 15:34:21 +0100
committerGene Pasquet <dev@etenil.net>2026-04-05 15:34:21 +0100
commit2a75c88de470a173067feee4df80cd8e3fb7a641 (patch)
tree65f6d158f635c82bf11c3b25a99f1404f3808fb4
parent526e6cdcdf1025d5e29680bc99ab910c79789764 (diff)
Cleanup and egg!
-rw-r--r--.gitignore6
-rw-r--r--Makefile9
-rw-r--r--downstroke.egg23
-rw-r--r--entity.scm2
-rw-r--r--input.scm4
-rw-r--r--physics.scm8
-rw-r--r--renderer.scm8
-rw-r--r--tests/entity-test.scm2
-rw-r--r--tests/input-test.scm4
-rw-r--r--tests/physics-test.scm12
-rw-r--r--tests/renderer-test.scm10
-rw-r--r--tests/tilemap-test.scm2
-rw-r--r--tests/world-test.scm8
-rw-r--r--tilemap.scm2
-rw-r--r--world.scm6
15 files changed, 69 insertions, 37 deletions
diff --git a/.gitignore b/.gitignore
index 47a40fa..b0e5472 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,8 +2,14 @@
.\#*
*~
/bin/
+/downstroke/
*.import.scm
+*.import.so
+*.so
*.o
+*.link
+*.build.sh
+*.install.sh
*.log
logs
/.agent-shell/
diff --git a/Makefile b/Makefile
index 960f42e..3fae2a7 100644
--- a/Makefile
+++ b/Makefile
@@ -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))))
diff --git a/entity.scm b/entity.scm
index cd467eb..3b12e2e 100644
--- a/entity.scm
+++ b/entity.scm
@@ -1,4 +1,4 @@
-(module entity
+(module downstroke/entity
*
(import scheme
(chicken base)
diff --git a/input.scm b/input.scm
index db581f0..e6b8940 100644
--- a/input.scm
+++ b/input.scm
@@ -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)
diff --git a/world.scm b/world.scm
index ee1d60c..2cd0feb 100644
--- a/world.scm
+++ b/world.scm
@@ -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.