diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-03-11 17:49:04 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-03-11 17:49:04 -0400 |
| commit | 1f6e586b2a3fe7f8ca32ce95659032bafef0ad24 (patch) | |
| tree | 49b6633bf0693952153f12e8ed4dce1dae1443cc /examples/game/game.tm | |
| parent | fb2d7b5379663e929ffabfbd8428de5b35ad67c4 (diff) | |
Support external structs with namespaced methods (also C-strings are now
`const char*` instead of `char*`)
Diffstat (limited to 'examples/game/game.tm')
| -rw-r--r-- | examples/game/game.tm | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/examples/game/game.tm b/examples/game/game.tm index 86e4e01c..e0bf7b32 100644 --- a/examples/game/game.tm +++ b/examples/game/game.tm @@ -1,40 +1,29 @@ # This game demo uses Raylib to present a simple -use libraylib.so -use <raylib.h> -use <raymath.h> - +use ./raylib.tm use ./world.tm func main(map=(./map.txt)): - extern InitWindow:func(w:Int32, h:Int32, title:CString) InitWindow(1600, 900, CString("raylib [core] example - 2d camera")) map_contents := map:read() or exit("Could not find the game map: $map") - World.CURRENT:load_map(map_contents) + world := @World( + player=@Player(Vector2(0,0), Vector2(0,0)), + goal=@Box(Vector2(0,0), Vector2(50,50), color=Color(0x10,0xa0,0x10)), + boxes=@[:@Box], + ) + world:load_map(map_contents) - extern SetTargetFPS:func(fps:Int32) SetTargetFPS(60) - extern WindowShouldClose:func(->Bool) - while not WindowShouldClose(): - extern GetFrameTime:func(->Num32) dt := GetFrameTime() - World.CURRENT:update(Num(dt)) + world:update(dt) - extern BeginDrawing:func() BeginDrawing() - - inline C { - ClearBackground((Color){0xCC, 0xCC, 0xCC, 0xFF}); - } - - World.CURRENT:draw() - - extern EndDrawing:func() + ClearBackground(Color(0xCC, 0xCC, 0xCC, 0xFF)) + world:draw() EndDrawing() - extern CloseWindow:func() CloseWindow() |
