# m2SDL summary — v0.2.0 (2026-09-23) SDL2 bindings for GNU Modula-2 (`gm2` 16.0.1, SDL 2.32.4, Linux). All builds verified with `make`; tests also pass headless via `SDL_VIDEODRIVER=dummy`. ## v0.1.0 (`c4aa35b`) — starter set - `src/SDL2.def` — init/quit, `GetError`, delay, ticks, perf counter - `src/SDLVersion.def` — `SDLVersion` record (`CARDINAL8` fields), `GetVersion`, `GetRevision` - `src/SDLVideo.def` — opaque `WindowHandle`, create/destroy, title, size, show/hide, window flag/position constants - `src/SDLEvents.def` — opaque 56-byte event pump (`PumpEvents`, `PollEvent`, `WaitEvent`), quit/key/mouse type ids - `src/SDLRect.def/.mod` — pure-M2 `SDLPoint`/`SDLRect` + helpers - `lib/SDLUtils.def/.mod` — `CStrToM2`, `GetErrorString` - `tests/` — init, version, rect, window + `run_tests.sh` (4/4 green) - `examples/` — `hello_window`, `version`, `event_loop` - `Makefile` — two-step gm2 build (`-c` helpers to `.o`, then link) ## v0.2.0 — renderer + showcases - `src/SDLRender.def` — SDL2 `` subset: `CreateRenderer`, `CreateWindowAndRenderer`, draw color (`CARDINAL8` = Uint8), clear/present, points/lines/rects in single (`VAR`) and array (`ADR` + count) forms, logical size - `lib/SDLUtils.DrainEvents` — shared quit-event pump - `showcases/` — ports of `SDL-main/examples/renderer/` (public domain): `showcase_clear` (01), `showcase_rectangles` (05), `showcase_primitives` (02); SDL3 to SDL2 adaptations in each header - `showcases/README.md` — source map, build/run instructions - Vendored `SDL-main/` sources ignored via `.gitignore` (`2543b44`) ## GM2 FFI rules learned (encoded in code) 1. `DEFINITION MODULE FOR "C"` + `EXPORT UNQUALIFIED`, link with `-lSDL2`. 2. No `*)` inside `(* *)` comments — C pointer spellings need a space. 3. `CARDINAL` <-> Uint32, `INTEGER` <-> int, opaque pointers = `ADDRESS`, `ARRAY OF CHAR` params = `char *`, `VAR` record params = `T *`. 4. Int-returning C procs need `[ INTEGER ]` to be called as statements. 5. `Uint8` params must be `SYSTEM.CARDINAL8` (16-bit `SHORTCARD` breaks ABI). 6. Same-size casts only: `INTEGER(x)` fails across sizes, use `VAL`. 7. Pure-M2 helpers compile with `gm2 -c` to `.o`, then link (passing `.mod` directly duplicates `main`). 8. `gm2` sources must be 7-bit ASCII in practice (unicode confused it). ## Next Full `SDL_Event` variant record, renderer textures/surfaces, audio, joystick/gamepad, then SDL3 bindings alongside.