diff options
| author | Gene Pasquet <dev@etenil.net> | 2026-04-18 05:49:34 +0100 |
|---|---|---|
| committer | Gene Pasquet <dev@etenil.net> | 2026-04-18 05:49:34 +0100 |
| commit | c2085be2dd2a0cb3da05991847e35080915e547e (patch) | |
| tree | e89a0f3c347b3106b15b69b09dcf29f93a7ef627 | |
| parent | 38eee24832fe6da4f135cae455881ab97953b23a (diff) | |
rename modules
47 files changed, 247 insertions, 246 deletions
@@ -14,6 +14,7 @@ logs /.agent-shell/ CLAUDE.md +/.plan-*.md superpowers/* /public superpowers @@ -7,7 +7,7 @@ OBJECT_FILES := $(patsubst %,bin/%.o,$(MODULE_NAMES)) DEMO_NAMES := getting-started platformer shmup topdown audio sandbox spritefont menu tweens scaling animation DEMO_BINS := $(patsubst %,bin/demo-%,$(DEMO_NAMES)) -UNIT_NAMES := $(patsubst %,downstroke-%,$(MODULE_NAMES)) +UNIT_NAMES := $(patsubst %,downstroke.%,$(MODULE_NAMES)) USES_FLAGS := $(patsubst %,-uses %,$(UNIT_NAMES)) # Build all engine modules @@ -34,8 +34,8 @@ bin/scene-loader.o: bin/world.o bin/tilemap.o bin/assets.o bin/engine.o bin/pref # Pattern rule: compile each module as a library unit bin/%.o: %.scm | bin - csc -c -J -unit downstroke-$* $*.scm -o bin/$*.o -I bin - @if [ -f downstroke-$*.import.scm ]; then mv downstroke-$*.import.scm bin/; fi + csc -c -J -unit downstroke.$* $*.scm -o bin/$*.o -I bin + @if [ -f downstroke.$*.import.scm ]; then mv downstroke.$*.import.scm bin/; fi .PHONY: clean test engine demos filter diff --git a/animation.scm b/animation.scm index b7fe9c7..96718ec 100644 --- a/animation.scm +++ b/animation.scm @@ -1,9 +1,9 @@ -(module downstroke-animation * +(module (downstroke animation) * (import scheme (chicken base) (only srfi-1 filter) - downstroke-entity - downstroke-world) + (downstroke entity) + (downstroke world)) ;; Animation definitions are alists (converted from plist form in the user's ;; prefab data file by load-prefabs). Each animation is an alist with keys @@ -1,4 +1,4 @@ -(module downstroke-assets * +(module (downstroke assets) * (import scheme (chicken base) diff --git a/demo/animation.scm b/demo/animation.scm index 6d8e389..49b773d 100644 --- a/demo/animation.scm +++ b/demo/animation.scm @@ -3,13 +3,13 @@ (only srfi-1 iota) (prefix sdl2 "sdl2:") (prefix sdl2-ttf "ttf:") - downstroke-engine - downstroke-world - downstroke-renderer - downstroke-entity - downstroke-prefabs - downstroke-scene-loader - downstroke-tilemap) + (downstroke engine) + (downstroke world) + (downstroke renderer) + (downstroke entity) + (downstroke prefabs) + (downstroke scene-loader) + (downstroke tilemap)) ;; ── State ──────────────────────────────────────────────────────────────────── diff --git a/demo/audio.scm b/demo/audio.scm index 8e3fead..401c171 100644 --- a/demo/audio.scm +++ b/demo/audio.scm @@ -3,11 +3,11 @@ (prefix sdl2 "sdl2:") (prefix sdl2-ttf "ttf:") (prefix sdl2-image "img:") - downstroke-engine - downstroke-renderer - downstroke-input - downstroke-assets - downstroke-sound) + (downstroke engine) + (downstroke renderer) + (downstroke input) + (downstroke assets) + (downstroke sound)) (define *music-on?* #f) diff --git a/demo/getting-started.scm b/demo/getting-started.scm index 07014d9..c253797 100644 --- a/demo/getting-started.scm +++ b/demo/getting-started.scm @@ -4,11 +4,11 @@ (import scheme (chicken base) (only (list-utils alist) plist->alist) - downstroke-engine - downstroke-world - downstroke-entity - downstroke-input - downstroke-scene-loader) + (downstroke engine) + (downstroke world) + (downstroke entity) + (downstroke input) + (downstroke scene-loader)) (define +speed+ 2) diff --git a/demo/menu.scm b/demo/menu.scm index 67fd655..2015df6 100644 --- a/demo/menu.scm +++ b/demo/menu.scm @@ -2,9 +2,9 @@ (chicken base) (prefix sdl2 "sdl2:") (prefix sdl2-ttf "ttf:") - downstroke-engine - downstroke-renderer - downstroke-input) + (downstroke engine) + (downstroke renderer) + (downstroke input)) (define *menu-cursor* 0) (define *menu-items* '("Play" "Quit")) diff --git a/demo/platformer.scm b/demo/platformer.scm index c11c390..11a782d 100644 --- a/demo/platformer.scm +++ b/demo/platformer.scm @@ -5,14 +5,14 @@ (prefix sdl2 "sdl2:") (prefix sdl2-ttf "ttf:") (prefix sdl2-image "img:") - downstroke-engine - downstroke-world - downstroke-input - downstroke-physics - downstroke-assets - downstroke-entity - downstroke-sound - downstroke-scene-loader) + (downstroke engine) + (downstroke world) + (downstroke input) + (downstroke physics) + (downstroke assets) + (downstroke entity) + (downstroke sound) + (downstroke scene-loader)) (define +debug?+ (and (member "--debug" (command-line-arguments)) #t)) diff --git a/demo/sandbox.scm b/demo/sandbox.scm index 9d6b0fe..0851f16 100644 --- a/demo/sandbox.scm +++ b/demo/sandbox.scm @@ -6,15 +6,15 @@ (prefix sdl2 "sdl2:") (prefix sdl2-ttf "ttf:") (prefix sdl2-image "img:") - downstroke-engine - downstroke-world - downstroke-tilemap - downstroke-physics - downstroke-assets - downstroke-entity - downstroke-scene-loader - downstroke-tween - downstroke-prefabs) + (downstroke engine) + (downstroke world) + (downstroke tilemap) + (downstroke physics) + (downstroke assets) + (downstroke entity) + (downstroke scene-loader) + (downstroke tween) + (downstroke prefabs)) ;; ── Constants ──────────────────────────────────────────────────────────────── diff --git a/demo/scaling.scm b/demo/scaling.scm index e00c797..3724a59 100644 --- a/demo/scaling.scm +++ b/demo/scaling.scm @@ -3,12 +3,12 @@ (only (list-utils alist) plist->alist) (prefix sdl2 "sdl2:") (prefix sdl2-ttf "ttf:") - downstroke-engine - downstroke-world - downstroke-entity - downstroke-input - downstroke-renderer - downstroke-assets) + (downstroke engine) + (downstroke world) + (downstroke entity) + (downstroke input) + (downstroke renderer) + (downstroke assets)) ;; Logical resolution: 320×240, displayed at 640×480 via scale: 2 diff --git a/demo/shmup.scm b/demo/shmup.scm index 6d6ffe0..3406f4a 100644 --- a/demo/shmup.scm +++ b/demo/shmup.scm @@ -7,13 +7,13 @@ (prefix sdl2 "sdl2:") (prefix sdl2-ttf "ttf:") (prefix sdl2-image "img:") - downstroke-engine - downstroke-world - downstroke-physics - downstroke-input - downstroke-entity - downstroke-assets - downstroke-sound) + (downstroke engine) + (downstroke world) + (downstroke physics) + (downstroke input) + (downstroke entity) + (downstroke assets) + (downstroke sound)) ;; ── Constants ──────────────────────────────────────────────────────────────── diff --git a/demo/spritefont.scm b/demo/spritefont.scm index ef70461..261de73 100644 --- a/demo/spritefont.scm +++ b/demo/spritefont.scm @@ -3,12 +3,12 @@ (prefix sdl2 "sdl2:") (prefix sdl2-ttf "ttf:") (prefix sdl2-image "img:") - downstroke-engine - downstroke-world - downstroke-tilemap - downstroke-renderer - downstroke-assets - downstroke-scene-loader) + (downstroke engine) + (downstroke world) + (downstroke tilemap) + (downstroke renderer) + (downstroke assets) + (downstroke scene-loader)) (define *sprite-font* #f) diff --git a/demo/topdown.scm b/demo/topdown.scm index 13e4cc8..07ad7e9 100644 --- a/demo/topdown.scm +++ b/demo/topdown.scm @@ -6,12 +6,12 @@ (prefix sdl2 "sdl2:") (prefix sdl2-ttf "ttf:") (prefix sdl2-image "img:") - downstroke-engine - downstroke-world - downstroke-input - downstroke-assets - downstroke-entity - downstroke-scene-loader) + (downstroke engine) + (downstroke world) + (downstroke input) + (downstroke assets) + (downstroke entity) + (downstroke scene-loader)) (define (make-player) (plist->alist (list #:type 'player diff --git a/demo/tweens.scm b/demo/tweens.scm index b56676e..7ca3491 100644 --- a/demo/tweens.scm +++ b/demo/tweens.scm @@ -4,11 +4,11 @@ (only (list-utils alist) plist->alist) (prefix sdl2 "sdl2:") (prefix sdl2-ttf "ttf:") - downstroke-engine - downstroke-world - downstroke-renderer - downstroke-entity - downstroke-tween) + (downstroke engine) + (downstroke world) + (downstroke renderer) + (downstroke entity) + (downstroke tween)) ;; ── Constants ──────────────────────────────────────────────────────────────── diff --git a/docs/audio.org b/docs/audio.org index 7d83e44..464e2c8 100644 --- a/docs/audio.org +++ b/docs/audio.org @@ -3,7 +3,7 @@ Downstroke's audio stack is a thin wrapper around SDL2's =SDL_mixer= library. It gives you two things: short /sound effects/ (one-shots triggered on input, collisions, pickups, etc.) and a single streaming /music/ track (a looping -background song). The friendly API lives in the =downstroke-sound= module and +background song). The friendly API lives in the =(downstroke sound)= module and is the only thing most games ever need to touch. Audio is deliberately kept outside the [[file:guide.org][=game= record]]. The sound module @@ -15,8 +15,8 @@ manage audio for you. * The minimum you need #+begin_src scheme -(import downstroke-engine - downstroke-sound) +(import (downstroke engine) + (downstroke sound)) (define *music-on?* #f) @@ -54,25 +54,25 @@ Four calls cover ~95% of real usage: Audio is split into two modules, and you pick the one that matches what you are doing: -- =downstroke-sound= — the friendly, high-level API. Symbolic sound names, an +- =(downstroke sound)= — the friendly, high-level API. Symbolic sound names, an internal registry, volume given as =0.0..1.0=, music that just loops. This is what the rest of this document documents, and what every demo uses. -- =downstroke-mixer= — raw FFI bindings to =SDL_mixer= +- =(downstroke mixer)= — raw FFI bindings to =SDL_mixer= (=Mix_OpenAudio=, =Mix_LoadWAV=, =Mix_PlayChannel=, =Mix_LoadMUS=, =Mix_PlayMusic=, =Mix_VolumeMusic=, …). No registry, no convenience, no type conversions. Values are raw C-level integers (volumes are =0..128=, channels are integers, loops is an integer count with =-1= for forever). -Reach for =downstroke-mixer= only when you need something the high-level +Reach for =(downstroke mixer)= only when you need something the high-level wrapper does not expose — for example, playing more than one concurrent music -track via channel groups, or fading effects. In practice, =downstroke-sound= -covers 99% of cases; you almost never =import downstroke-mixer= directly in +track via channel groups, or fading effects. In practice, =(downstroke sound)= +covers 99% of cases; you almost never =import (downstroke mixer)= directly in game code. *** Module-level state (be aware of this) -=downstroke-sound= keeps two global variables inside the module: +=(downstroke sound)= keeps two global variables inside the module: - =*sound-registry*= — an association list of =(symbol . Mix_Chunk*)= pairs populated by =load-sounds!=. @@ -87,7 +87,7 @@ This means: alist. - Calling =load-music!= replaces =*music*= without freeing the previous track — use =cleanup-audio!= if you need to swap tracks cleanly, or drop - into =downstroke-mixer= and call =mix-free-music!= yourself. + into =(downstroke mixer)= and call =mix-free-music!= yourself. - Two games in the same process would share this state. That is not a supported configuration; one =game-run!= per process is the expectation. @@ -175,7 +175,7 @@ and null chunks are silently ignored. SDL_mixer defaults to 8 simultaneous channels. If all channels are busy, the new sound is dropped. For most 2D games this is plenty; if you need -more, use =downstroke-mixer= directly and call =Mix_AllocateChannels=. +more, use =(downstroke mixer)= directly and call =Mix_AllocateChannels=. Volume on individual effects is not exposed by the high-level API — every chunk plays at the mixer's current chunk volume. If you need per-sound @@ -294,10 +294,10 @@ A full on/off toggle, as seen in the audio demo, looks like this: To change songs cleanly, halt the current one, free it, and load the new one. The high-level API does not free for you, so either call =cleanup-audio!= (which also closes the device — probably not what you want -mid-game) or drop to =downstroke-mixer=: +mid-game) or drop to =(downstroke mixer)=: #+begin_src scheme -(import downstroke-mixer) +(import (downstroke mixer)) (define (swap-music! path volume) (stop-music!) diff --git a/docs/entities.org b/docs/entities.org index 94e572c..2e97782 100644 --- a/docs/entities.org +++ b/docs/entities.org @@ -9,9 +9,9 @@ are no classes, no inheritance, no hidden state. You build entities either by hand as a plist and converting with =plist->alist=, or from a *prefab* data file that composes named mixins with inline fields. -The module that owns this vocabulary is =downstroke-entity= (all the +The module that owns this vocabulary is =(downstroke entity)= (all the =entity-*= procedures and the =define-pipeline= macro). The companion -module =downstroke-prefabs= loads prefab data files and instantiates +module =(downstroke prefabs)= loads prefab data files and instantiates them. Most games will touch both. * The minimum you need @@ -21,7 +21,7 @@ From the getting-started demo (=demo/getting-started.scm=): #+begin_src scheme (import (only (list-utils alist) plist->alist) - downstroke-entity) + (downstroke entity)) (define (make-player) (plist->alist @@ -144,7 +144,7 @@ Because everything is immutable, update chains are usually written as ** Prefabs and mixins Hand-writing a long plist for every enemy gets old fast. The -=downstroke-prefabs= module loads a data file that declares reusable +=(downstroke prefabs)= module loads a data file that declares reusable *mixins* (named bundles of keys) and *prefabs* (named entities built by combining mixins and inline overrides). @@ -205,7 +205,7 @@ Load a prefab file once at =create:= time, then instantiate as many entities as you need: #+begin_src scheme -(import downstroke-prefabs) +(import (downstroke prefabs)) (define registry (load-prefabs "demo/assets/animation-prefabs.scm" @@ -253,7 +253,7 @@ The predicate is =entity-skips-pipeline?=: #+end_src Every built-in step is defined with the =define-pipeline= macro -(=downstroke-entity=), which wraps the body in the skip check. The +(=(downstroke entity)=), which wraps the body in the skip check. The macro has two shapes: #+begin_src scheme @@ -363,7 +363,7 @@ reach for =define-pipeline= instead of writing a plain function. A minimal example: #+begin_src scheme -(import downstroke-entity) +(import (downstroke entity)) ;; A decay step. Users can skip it with #:skip-pipelines '(decay). (define-pipeline (apply-decay decay) (scene entity dt) diff --git a/docs/guide.org b/docs/guide.org index 1b16d92..21a70bc 100644 --- a/docs/guide.org +++ b/docs/guide.org @@ -14,7 +14,7 @@ The smallest Downstroke program you can write opens a window, runs the main loop #+begin_src scheme (import scheme (chicken base) - downstroke-engine) + (downstroke engine)) (game-run! (make-game @@ -53,9 +53,9 @@ In the ~create:~ hook you typically build a scene and hand it to the game with ~ #+begin_src scheme (import scheme (chicken base) - downstroke-engine - downstroke-world - downstroke-scene-loader) + (downstroke engine) + (downstroke world) + (downstroke scene-loader)) (game-run! (make-game @@ -108,7 +108,7 @@ Compile and run, and you should see a light-blue 32×32 square on a dark backgro ** Reading input -Input in Downstroke is organised around /actions/ rather than raw keys. The engine ships with a default input config (~*default-input-config*~ in ~downstroke-input~) that maps the arrow keys, WASD, a couple of action buttons, and game-controller buttons to a small set of action symbols: +Input in Downstroke is organised around /actions/ rather than raw keys. The engine ships with a default input config (~*default-input-config*~ in ~(downstroke input)~) that maps the arrow keys, WASD, a couple of action buttons, and game-controller buttons to a small set of action symbols: | Action | Default keys | |----------+-------------------| @@ -123,7 +123,7 @@ Input in Downstroke is organised around /actions/ rather than raw keys. The engi | ~quit~ | =Escape= | -Inside ~update:~ you reach the input state with ~(game-input game)~, and then query it with three predicates from ~downstroke-input~: +Inside ~update:~ you reach the input state with ~(game-input game)~, and then query it with three predicates from ~(downstroke input)~: - ~(input-held? input 'left)~ — ~#t~ while the player holds the action down. - ~(input-pressed? input 'a)~ — ~#t~ only on the first frame the action goes down (edge). @@ -193,11 +193,11 @@ Here is the full =demo/getting-started.scm= source. Read it top to bottom — ea (import scheme (chicken base) (only (list-utils alist) plist->alist) - downstroke-engine - downstroke-world - downstroke-entity - downstroke-input - downstroke-scene-loader) + (downstroke engine) + (downstroke world) + (downstroke entity) + (downstroke input) + (downstroke scene-loader)) (define +speed+ 2) diff --git a/docs/input.org b/docs/input.org index 81ff65e..a7f7fc5 100644 --- a/docs/input.org +++ b/docs/input.org @@ -15,10 +15,10 @@ through =game-input=. * The minimum you need #+begin_src scheme -(import downstroke-engine - downstroke-input - downstroke-world - downstroke-entity) +(import (downstroke engine) + (downstroke input) + (downstroke world) + (downstroke entity)) (game-run! (make-game diff --git a/docs/physics.org b/docs/physics.org index 9cf9b96..233ffc8 100644 --- a/docs/physics.org +++ b/docs/physics.org @@ -149,7 +149,7 @@ All per-entity steps have the signature =(step scene entity dt)=. - *Reads*: =#:gravity?=, =#:vy= (default 0) - *Writes*: =#:vy= (set to =(+ vy *gravity*)=) - *Guard*: only runs when =#:gravity? #t= -- =*gravity*= is exported from =downstroke-physics=; its value is +- =*gravity*= is exported from =(downstroke physics)=; its value is =1= pixel/frame². Gravity accumulates until =resolve-tile-collisions-y= zeroes =#:vy= on contact with the floor. @@ -294,7 +294,7 @@ pair walk. *** =#:skip-pipelines= per-entity override Every per-entity step is also gated by =entity-skips-pipeline?= (from -=downstroke-entity=). If the entity's =#:skip-pipelines= list contains +=(downstroke entity)=). If the entity's =#:skip-pipelines= list contains the step's *symbol*, the step returns the entity unchanged. The symbols match the second name in each =define-pipeline= form: @@ -335,7 +335,7 @@ collisions, and still detect ground under it. *** =define-pipeline= (how steps are declared) All per-entity pipeline steps are declared with =define-pipeline= from -=downstroke-entity= (see =docs/entities.org=). The shape is: +=(downstroke entity)= (see =docs/entities.org=). The shape is: #+begin_src scheme (define-pipeline (procedure-name skip-symbol) (scene entity dt) @@ -391,7 +391,7 @@ per-pixel collision are not supported. *** Tile collision algorithm -Tiles come from a =downstroke-tilemap= parsed from a TMX file (Tiled +Tiles come from a =(downstroke tilemap)= parsed from a TMX file (Tiled editor). The tilemap stores a grid of tile ids across one or more layers; =tilemap-tile-at= returns =0= for an empty cell and a positive id for a filled cell. Only *empty vs non-empty* is checked — there is @@ -604,7 +604,7 @@ push-apart: With ='none=, nothing in =physics.scm= runs unless you call it yourself. You still have access to every physics procedure as a library: =apply-velocity-x=, =aabb-overlap?=, =resolve-tile-collisions-y=, -and so on are all exported from =downstroke-physics= and usable +and so on are all exported from =(downstroke physics)= and usable individually. ='none= just disables the *automatic* orchestration. ** Reading =#:on-ground?= to gate jumps diff --git a/docs/scenes.org b/docs/scenes.org index da62291..87b9256 100644 --- a/docs/scenes.org +++ b/docs/scenes.org @@ -15,10 +15,10 @@ The smallest scene is a sprite-only one with a single entity, built inside the ~ (import scheme (chicken base) (only (list-utils alist) plist->alist) - downstroke-engine - downstroke-world - downstroke-entity - downstroke-scene-loader) + (downstroke engine) + (downstroke world) + (downstroke entity) + (downstroke scene-loader)) (define (make-player) (plist->alist @@ -43,7 +43,7 @@ That is all that is required to put a blue square on a dark background. ~make-sp ** The scene record -~scene~ is a record type defined with ~defstruct~ in ~downstroke-world~. Its fields map one-to-one onto the things the engine needs to know about the current frame: +~scene~ is a record type defined with ~defstruct~ in ~(downstroke world)~. Its fields map one-to-one onto the things the engine needs to know about the current frame: | Field | Type | Purpose | |-------------------+--------------------------------+--------------------------------------------------------------------------------------------------| @@ -101,7 +101,7 @@ This is the form the ~shmup~ and ~scaling~ demos use to turn off the physics pip *** ~make-sprite-scene~ — convenient sprite-only scenes -~make-sprite-scene~ lives in ~downstroke-scene-loader~ and wraps ~make-scene~ with sensible defaults for sprite-only games: +~make-sprite-scene~ lives in ~(downstroke scene-loader)~ and wraps ~make-scene~ with sensible defaults for sprite-only games: #+begin_src scheme (make-sprite-scene @@ -175,7 +175,7 @@ This pattern — load once in ~preload:~ (or early in ~create:~), retrieve many ** Manipulating scene entities -All scene transformers in ~downstroke-world~ are /functional/: they take a scene and return a new one. Nothing is mutated; the idiomatic pattern inside an ~update:~ hook is always +All scene transformers in ~(downstroke world)~ are /functional/: they take a scene and return a new one. Nothing is mutated; the idiomatic pattern inside an ~update:~ hook is always #+begin_src scheme (game-scene-set! game (<transformer> (game-scene game) ...)) @@ -197,7 +197,7 @@ or, when composing multiple transformations, a ~chain~ form from ~srfi-197~. ~(scene-map-entities scene proc ...)~ applies each ~proc~ in sequence to every entity in the scene. Each ~proc~ has the signature ~(lambda (scene entity) ...) → entity~ — it receives the /current/ scene (read-only, snapshot at the start of the call) and one entity, and must return a replacement entity. Multiple procs are applied like successive ~map~ passes, in argument order. -This is the workhorse of the physics pipeline; see ~default-engine-update~ in ~downstroke-engine~ for how it is chained to apply acceleration, gravity, velocity, and so on. In game code you use it for per-entity updates that do not need to see each other: +This is the workhorse of the physics pipeline; see ~default-engine-update~ in ~(downstroke engine)~ for how it is chained to apply acceleration, gravity, velocity, and so on. In game code you use it for per-entity updates that do not need to see each other: #+begin_src scheme (scene-map-entities scene diff --git a/docs/tweens.org b/docs/tweens.org index d1ee966..063a485 100644 --- a/docs/tweens.org +++ b/docs/tweens.org @@ -7,7 +7,7 @@ up for use inside your =update:= hook. You build a tween with engine advances it for you every frame. When it finishes, it removes itself. -This doc covers the =downstroke-tween= module: =make-tween=, the +This doc covers the =(downstroke tween)= module: =make-tween=, the =step-tweens= pipeline step, and every easing curve shipped in the =*ease-table*=. @@ -16,7 +16,7 @@ This doc covers the =downstroke-tween= module: =make-tween=, the A one-shot slide to the right, 500 ms, linear ease: #+BEGIN_SRC scheme -(import downstroke-tween) +(import (downstroke tween)) (let ((e (entity-set (make-entity 0 100 16 16) #:type 'slider))) (entity-set e #:tween diff --git a/downstroke.egg b/downstroke.egg index c069e85..f22dcf5 100644 --- a/downstroke.egg +++ b/downstroke.egg @@ -6,41 +6,41 @@ (dependencies sdl2 sdl2-image sdl2-ttf expat defstruct srfi-1 srfi-13 srfi-69 srfi-197 matchable simple-logger list-utils) (test-dependencies test) (components - (extension downstroke-entity + (extension downstroke.entity (source "entity.scm")) - (extension downstroke-tween + (extension downstroke.tween (source "tween.scm") - (component-dependencies downstroke-entity)) - (extension downstroke-tilemap + (component-dependencies downstroke.entity)) + (extension downstroke.tilemap (source "tilemap.scm")) - (extension downstroke-world + (extension downstroke.world (source "world.scm") - (component-dependencies downstroke-entity downstroke-tilemap)) - (extension downstroke-physics + (component-dependencies downstroke.entity downstroke.tilemap)) + (extension downstroke.physics (source "physics.scm") - (component-dependencies downstroke-entity downstroke-tilemap downstroke-world)) - (extension downstroke-input + (component-dependencies downstroke.entity downstroke.tilemap downstroke.world)) + (extension downstroke.input (source "input.scm") - (component-dependencies downstroke-entity)) - (extension downstroke-assets + (component-dependencies downstroke.entity)) + (extension downstroke.assets (source "assets.scm")) - (extension downstroke-renderer + (extension downstroke.renderer (source "renderer.scm") - (component-dependencies downstroke-entity downstroke-tilemap downstroke-world)) - (extension downstroke-engine + (component-dependencies downstroke.entity downstroke.tilemap downstroke.world)) + (extension downstroke.engine (source "engine.scm") - (component-dependencies downstroke-renderer downstroke-world downstroke-input downstroke-assets)) - (extension downstroke-mixer + (component-dependencies downstroke.renderer downstroke.world downstroke.input downstroke.assets)) + (extension downstroke.mixer (source "mixer.scm")) - (extension downstroke-sound + (extension downstroke.sound (source "sound.scm") - (component-dependencies downstroke-mixer)) - (extension downstroke-animation + (component-dependencies downstroke.mixer)) + (extension downstroke.animation (source "animation.scm") - (component-dependencies downstroke-entity downstroke-world)) - (extension downstroke-prefabs + (component-dependencies downstroke.entity downstroke.world)) + (extension downstroke.prefabs (source "prefabs.scm") - (component-dependencies downstroke-entity)) - (extension downstroke-scene-loader + (component-dependencies downstroke.entity)) + (extension downstroke.scene-loader (source "scene-loader.scm") - (component-dependencies downstroke-world downstroke-tilemap downstroke-assets downstroke-engine downstroke-prefabs)))) + (component-dependencies downstroke.world downstroke.tilemap downstroke.assets downstroke.engine downstroke.prefabs)))) @@ -1,4 +1,4 @@ -(module downstroke-engine * +(module (downstroke engine) * (import scheme (chicken base) @@ -8,13 +8,13 @@ (srfi 69) (only srfi-197 chain) defstruct - downstroke-world - downstroke-input - downstroke-physics - downstroke-tween - downstroke-assets - downstroke-animation - downstroke-renderer) + (downstroke world) + (downstroke input) + (downstroke physics) + (downstroke tween) + (downstroke assets) + (downstroke animation) + (downstroke renderer)) ;; ── Game struct ──────────────────────────────────────────────────────────── ;; defstruct auto-generates make-game, which we'll wrap with default values @@ -1,4 +1,4 @@ -(module downstroke-entity +(module (downstroke entity) * (import scheme (chicken base) @@ -1,4 +1,4 @@ -(module downstroke-input +(module (downstroke input) * (import scheme @@ -9,7 +9,7 @@ (only srfi-197 chain) (prefix sdl2 sdl2:) simple-logger - downstroke-entity + (downstroke entity) defstruct) ;; Input configuration record @@ -1,4 +1,4 @@ -(module downstroke-mixer * +(module (downstroke mixer) * (import scheme (chicken base) (chicken foreign)) diff --git a/physics.scm b/physics.scm index 543e786..92e50dc 100644 --- a/physics.scm +++ b/physics.scm @@ -1,4 +1,4 @@ -(module downstroke-physics +(module (downstroke physics) (resolve-entity-collisions resolve-pair aabb-overlap? push-apart push-along-axis aabb-overlap-on-axis @@ -14,9 +14,9 @@ (chicken keyword) (only srfi-1 any fold iota) defstruct - downstroke-tilemap - downstroke-entity - downstroke-world + (downstroke tilemap) + (downstroke entity) + (downstroke world) simple-logger) ;; Gravity constant: pixels per frame per frame @@ -30,7 +30,7 @@ ;; If |vy| is above this, another entity does not count as ground (mid-air / fast fall). (define *entity-ground-vy-max* 12) -;; Per-entity steps use define-pipeline from downstroke-entity (see docs/physics.org +;; Per-entity steps use define-pipeline from (downstroke entity) (see docs/physics.org ;; for #:skip-pipelines symbol names). ;; Consume #:ay into #:vy and clear it (one-shot acceleration) @@ -64,10 +64,10 @@ (y (entity-ref entity #:y 0)) (vx (entity-ref entity #:vx 0)) (vy (entity-ref entity #:vy 0)) - (e (if (downstroke-entity#entity-skips-pipeline? entity 'velocity-x) + (e (if (downstroke.entity#entity-skips-pipeline? entity 'velocity-x) entity (entity-set entity #:x (+ x vx)))) - (e (if (downstroke-entity#entity-skips-pipeline? entity 'velocity-y) + (e (if (downstroke.entity#entity-skips-pipeline? entity 'velocity-y) e (entity-set e #:y (+ (entity-ref e #:y 0) vy))))) e)) @@ -284,8 +284,8 @@ ;; Returns (a2 . b2) with positions/velocities adjusted, or #f if no collision. ;; #:immovable? #t marks static geometry; only the other entity is displaced. (define (resolve-pair a b) - (and (not (downstroke-entity#entity-skips-pipeline? a 'entity-collisions)) - (not (downstroke-entity#entity-skips-pipeline? b 'entity-collisions)) + (and (not (downstroke.entity#entity-skips-pipeline? a 'entity-collisions)) + (not (downstroke.entity#entity-skips-pipeline? b 'entity-collisions)) (entity-ref a #:solid? #f) (entity-ref b #:solid? #f) (aabb-overlap? (entity-ref a #:x 0) (entity-ref a #:y 0) diff --git a/prefabs.scm b/prefabs.scm index cf2896d..ac9d5d0 100644 --- a/prefabs.scm +++ b/prefabs.scm @@ -1,11 +1,11 @@ -(module downstroke-prefabs * +(module (downstroke prefabs) * (import scheme (chicken base) (only (chicken keyword) keyword?) srfi-1 (only (list-utils alist) plist->alist) defstruct - downstroke-entity) + (downstroke entity)) ;; Registry struct to hold prefab data (defstruct prefab-registry diff --git a/renderer.scm b/renderer.scm index 50ae574..2683442 100644 --- a/renderer.scm +++ b/renderer.scm @@ -1,4 +1,4 @@ -(module downstroke-renderer +(module (downstroke renderer) * (import scheme (chicken base) @@ -6,9 +6,9 @@ srfi-69 (prefix sdl2 "sdl2:") (prefix sdl2-ttf "ttf:") - downstroke-entity - downstroke-tilemap - downstroke-world) + (downstroke entity) + (downstroke tilemap) + (downstroke world)) (import defstruct) diff --git a/scene-loader.scm b/scene-loader.scm index c5f8947..50ad210 100644 --- a/scene-loader.scm +++ b/scene-loader.scm @@ -1,15 +1,15 @@ -(module downstroke-scene-loader * +(module (downstroke scene-loader) * (import scheme (chicken base) (only srfi-1 filter-map) (prefix sdl2 "sdl2:") (prefix sdl2-ttf "ttf:") defstruct - downstroke-tilemap - downstroke-world - downstroke-assets - downstroke-engine - downstroke-prefabs) + (downstroke tilemap) + (downstroke world) + (downstroke assets) + (downstroke engine) + (downstroke prefabs)) ;; Convert TMX object list to entities. @@ -1,8 +1,8 @@ -(module downstroke-sound * +(module (downstroke sound) * (import scheme (chicken base) (only srfi-1 for-each) - downstroke-mixer) + (downstroke mixer)) (define *sound-registry* '()) (define *music* #f) diff --git a/tests/animation-test.scm b/tests/animation-test.scm index adf534f..117e933 100644 --- a/tests/animation-test.scm +++ b/tests/animation-test.scm @@ -4,7 +4,7 @@ (include "tilemap.scm") (include "world.scm") (include "animation.scm") -(import downstroke-entity downstroke-world downstroke-animation) +(import (downstroke entity) (downstroke world) (downstroke animation)) ;; Test helpers: construct alist entities / animation defs from readable plist kwargs. (define (entity . kws) (plist->alist kws)) diff --git a/tests/assets-test.scm b/tests/assets-test.scm index 348cea0..5fea845 100644 --- a/tests/assets-test.scm +++ b/tests/assets-test.scm @@ -1,7 +1,7 @@ (import test) (include "assets.scm") -(import downstroke-assets) +(import (downstroke assets)) (test-begin "assets") diff --git a/tests/engine-test.scm b/tests/engine-test.scm index ddeb308..bfa6d75 100644 --- a/tests/engine-test.scm +++ b/tests/engine-test.scm @@ -41,7 +41,7 @@ (import (prefix sdl2-image "img:")) ;; --- Entity module (mock minimal structs) --- -(module downstroke-entity * +(module (downstroke entity) * (import scheme (chicken base)) (define (entity-ref entity key #!optional (default #f)) (let loop ((plist entity)) @@ -49,10 +49,10 @@ ((null? plist) (if (procedure? default) (default) default)) ((eq? (car plist) key) (cadr plist)) (else (loop (cddr plist))))))) -(import downstroke-entity) +(import (downstroke entity)) ;; --- Input module (mock) --- -(module downstroke-input * +(module (downstroke input) * (import scheme (chicken base) defstruct) (defstruct input-config actions keyboard-map joy-button-map controller-button-map @@ -78,12 +78,12 @@ state) (define (input-held? state action) #f)) -(import downstroke-input) +(import (downstroke input)) ;; --- World module (mock) --- -(module downstroke-world * +(module (downstroke world) * (import scheme (chicken base) defstruct) - (import downstroke-entity) + (import (downstroke entity)) (defstruct camera x y) (defstruct scene entities tilemap tileset camera tileset-texture camera-target background engine-update) ;; Mock camera-follow - returns a new camera @@ -106,15 +106,15 @@ (define (scene-transform-entities scene proc) (update-scene scene entities: (proc (scene-entities scene)))) (define (sync-groups entities) entities)) -(import downstroke-world) +(import (downstroke world)) ;; --- Real deps --- (import simple-logger) ;; required by input.scm (include "assets.scm") -(import downstroke-assets) +(import (downstroke assets)) ;; --- Physics module (mock) --- -(module downstroke-physics * +(module (downstroke physics) * (import scheme (chicken base)) (define (apply-acceleration e s d) e) (define (apply-gravity e s d) e) @@ -124,30 +124,30 @@ (define (resolve-tile-collisions-y e s d) e) (define (detect-on-solid e s d) e) (define (resolve-entity-collisions es) es)) -(import downstroke-physics) +(import (downstroke physics)) ;; --- Tween module (mock) --- -(module downstroke-tween * +(module (downstroke tween) * (import scheme (chicken base)) (define (step-tweens e s d) e)) -(import downstroke-tween) +(import (downstroke tween)) ;; --- Renderer module (mock) --- -(module downstroke-renderer * +(module (downstroke renderer) * (import scheme (chicken base)) (define (render-scene! . args) #f) (define (render-debug-scene! . args) #f)) -(import downstroke-renderer) +(import (downstroke renderer)) ;; --- Animation module (mock) --- -(module downstroke-animation * +(module (downstroke animation) * (import scheme (chicken base)) (define (apply-animation e s d) e)) -(import downstroke-animation) +(import (downstroke animation)) ;; --- Engine module (real) --- (include "engine.scm") -(import downstroke-engine) +(import (downstroke engine)) ;; --- Tests --- diff --git a/tests/entity-test.scm b/tests/entity-test.scm index d56e115..1e3ab19 100644 --- a/tests/entity-test.scm +++ b/tests/entity-test.scm @@ -1,6 +1,6 @@ (import test) (include "entity.scm") -(import downstroke-entity) +(import (downstroke entity)) (test-begin "entity") diff --git a/tests/input-test.scm b/tests/input-test.scm index 50395d8..2903cbb 100644 --- a/tests/input-test.scm +++ b/tests/input-test.scm @@ -12,7 +12,7 @@ ;; Load entity first (input imports it) (include "entity.scm") -(import downstroke-entity) +(import (downstroke entity)) (import (only (list-utils alist) plist->alist)) @@ -22,7 +22,7 @@ ;; Load the module source directly (include "input.scm") ;; Now import it to access the exported functions -(import downstroke-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 76b480c..e22c2fd 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 downstroke-tilemap * +(module (downstroke tilemap) * (import scheme (chicken base) defstruct) (defstruct tileset @@ -35,11 +35,11 @@ layers objects)) -(import downstroke-tilemap) +(import (downstroke tilemap)) ;; Load entity module first (since world now imports entity) (include "entity.scm") -(import downstroke-entity) +(import (downstroke entity)) (import (only (list-utils alist) plist->alist)) @@ -48,15 +48,15 @@ ;; Load world module first (include "world.scm") -(import downstroke-world) +(import (downstroke world)) ;; Load physics module (include "physics.scm") -(import downstroke-physics) +(import (downstroke physics)) ;; Load physics module (include "input.scm") -(import downstroke-input) +(import (downstroke input)) ;; Test suite for physics module (test-begin "physics-module") diff --git a/tests/prefabs-test.scm b/tests/prefabs-test.scm index 8eaf348..06f9ba9 100644 --- a/tests/prefabs-test.scm +++ b/tests/prefabs-test.scm @@ -7,8 +7,8 @@ defstruct test) -;; Mock downstroke-entity -(module downstroke-entity * +;; Mock (downstroke entity) +(module (downstroke entity) * (import scheme (chicken base)) (define (entity-ref entity key #!optional (default #f)) (let loop ((plist entity)) @@ -23,14 +23,14 @@ ((eq? (car plist) key) (append (reverse acc) (list key val) (cddr plist))) (else (loop (cddr plist) (cons (cadr plist) (cons (car plist) acc))))))) (define (entity-type entity) (entity-ref entity #:type #f))) -(import downstroke-entity) +(import (downstroke entity)) ;; Load module under test (include "entity.scm") -(import downstroke-entity) +(import (downstroke entity)) (include "prefabs.scm") -(import downstroke-prefabs) +(import (downstroke prefabs)) (test-begin "prefabs") diff --git a/tests/renderer-test.scm b/tests/renderer-test.scm index 702a712..3a85c73 100644 --- a/tests/renderer-test.scm +++ b/tests/renderer-test.scm @@ -8,7 +8,7 @@ test) ;; Mock tilemap module -(module downstroke-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) @@ -16,7 +16,7 @@ (defstruct tile id rect) (define (tileset-tile ts id) (make-tile id: id rect: #f)) (define (tile-rect t) #f)) -(import downstroke-tilemap) +(import (downstroke tilemap)) ;; Mock sdl2 (module sdl2 * @@ -40,7 +40,7 @@ ;; Load entity module (include "entity.scm") -(import downstroke-entity) +(import (downstroke entity)) (import (only (list-utils alist) plist->alist)) @@ -49,11 +49,11 @@ ;; Load world module (include "world.scm") -(import downstroke-world) +(import (downstroke world)) ;; Load renderer module (include "renderer.scm") -(import downstroke-renderer) +(import (downstroke renderer)) (test-begin "renderer") diff --git a/tests/scene-loader-test.scm b/tests/scene-loader-test.scm index f2ebde0..e86ea42 100644 --- a/tests/scene-loader-test.scm +++ b/tests/scene-loader-test.scm @@ -7,7 +7,7 @@ test) ;; Mock tilemap module -(module downstroke-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) @@ -18,11 +18,11 @@ (define (tile-rect t) #f) (define (load-tilemap filename) (make-tilemap width: 100 height: 100 tilewidth: 16 tileheight: 16 tileset-source: "" tileset: (make-tileset tilewidth: 16 tileheight: 16 spacing: 0 tilecount: 256 columns: 16 image-source: "" image: #f) layers: '() objects: '())) (define (load-tileset filename) (make-tileset tilewidth: 16 tileheight: 16 spacing: 0 tilecount: 256 columns: 16 image-source: "" image: #f))) -(import downstroke-tilemap) +(import (downstroke tilemap)) ;; Load the real entity module (alist-based) (include "entity.scm") -(import downstroke-entity) +(import (downstroke entity)) (import (only (list-utils alist) plist->alist)) @@ -30,28 +30,28 @@ (define (entity . kws) (plist->alist kws)) ;; Mock world module -(module downstroke-world * +(module (downstroke world) * (import scheme (chicken base) defstruct) (defstruct camera x y) (defstruct scene entities tilemap tileset camera tileset-texture camera-target background engine-update) (define (scene-add-entity scene entity) (update-scene scene entities: (append (scene-entities scene) (list entity))))) -(import downstroke-world) +(import (downstroke world)) ;; Mock assets module -(module downstroke-assets * +(module (downstroke assets) * (import scheme (chicken base)) (define (asset-set! assets key value) #f)) -(import downstroke-assets) +(import (downstroke assets)) ;; Mock engine module -(module downstroke-engine * +(module (downstroke engine) * (import scheme (chicken base)) (define (game-renderer game) #f) (define (game-asset-set! game key value) #f) (define (game-scene-set! game scene) #f)) -(import downstroke-engine) +(import (downstroke engine)) ;; Mock sdl2 (module sdl2 * @@ -65,19 +65,19 @@ (define (open-font filename size) (list 'font filename size))) (import (prefix sdl2-ttf "ttf:")) -;; Mock downstroke-prefabs +;; Mock (downstroke prefabs) ;; The mock registry is just an alist ((type . constructor) ...) for test simplicity. ;; instantiate-prefab maps to the constructor call. -(module downstroke-prefabs * +(module (downstroke prefabs) * (import scheme (chicken base)) (define (instantiate-prefab registry type x y w h) (let ((entry (assq type registry))) (and entry ((cdr entry) x y w h))))) -(import downstroke-prefabs) +(import (downstroke prefabs)) ;; Load scene-loader module (include "scene-loader.scm") -(import downstroke-scene-loader) +(import (downstroke scene-loader)) (test-begin "scene-loader") diff --git a/tests/tilemap-test.scm b/tests/tilemap-test.scm index 282400f..3fe5cfe 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 downstroke-tilemap) +(import (downstroke tilemap)) ;; Test suite for tilemap module (test-begin "tilemap-module") diff --git a/tests/tween-test.scm b/tests/tween-test.scm index 51675b8..31b4de3 100644 --- a/tests/tween-test.scm +++ b/tests/tween-test.scm @@ -2,7 +2,7 @@ (chicken base)) (include "entity.scm") (include "tween.scm") -(import downstroke-entity downstroke-tween) +(import (downstroke entity) (downstroke tween)) (import (only (list-utils alist) plist->alist)) diff --git a/tests/world-test.scm b/tests/world-test.scm index 8cbe4f2..0915cd2 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 downstroke-tilemap * +(module (downstroke tilemap) * (import scheme (chicken base) defstruct) (defstruct tileset @@ -35,11 +35,11 @@ layers objects)) -(import downstroke-tilemap) +(import (downstroke tilemap)) ;; Load entity module first (since world now imports entity) (include "entity.scm") -(import downstroke-entity) +(import (downstroke entity)) (import (only (list-utils alist) plist->alist)) @@ -49,7 +49,7 @@ ;; Load the module source directly (include "world.scm") ;; Now import it to access the exported functions -(import downstroke-world) +(import (downstroke world)) ;; Test suite for world module (test-begin "world-module") diff --git a/tilemap.scm b/tilemap.scm index 00b0508..7729a7a 100644 --- a/tilemap.scm +++ b/tilemap.scm @@ -1,4 +1,4 @@ -(module downstroke-tilemap +(module (downstroke tilemap) * (import scheme (chicken io) @@ -1,10 +1,10 @@ -(module downstroke-tween * +(module (downstroke tween) * (import scheme (chicken base) (chicken keyword) (only srfi-1 fold) defstruct - downstroke-entity) + (downstroke entity)) ;; ── Easing: t in [0,1] → eased factor in [0,1] for linear interpolation ── @@ -1,11 +1,11 @@ -(module downstroke-world +(module (downstroke world) * (import scheme (chicken base) (only srfi-1 fold filter) defstruct - downstroke-tilemap - downstroke-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. |
