test/snake/snake.c

changeset 96
9e25f080a33e
parent 93
52611a99e574
--- a/test/snake/snake.c	Thu Apr 24 19:53:40 2025 +0200
+++ b/test/snake/snake.c	Fri Apr 25 18:38:08 2025 +0200
@@ -37,6 +37,8 @@
 static AscTexture tex2d[TEX2D_COUNT];
 #define TEXTURE_SHIP &tex2d[TEX_SHIP]
 
+#define MAIN_SCENE asc_window_scene(0)
+
 static void destroy_textures(void *dummy) {
     asc_texture_destroy(tex2d, TEX2D_COUNT);
 }
@@ -101,8 +103,7 @@
         .height = 64
     );
 
-    // TODO: add to 2D scene instead of UI scene, once we have one
-    asc_add_ui_node(sprite);
+    asc_scene_add_node(MAIN_SCENE, sprite);
 
     // TODO: return something
 }
@@ -128,6 +129,11 @@
     settings.title = "Snake";
     asc_window_initialize(0, &settings);
 
+    // initialize the main scene (a 500x500 game field)
+    asc_scene_init(MAIN_SCENE);
+    // TODO: this is intentionally bullshit at the moment to force me to care about aspect ratio
+    asc_camera_ortho(&MAIN_SCENE->camera, (asc_recti){0, 0, 500, 500});
+
     // load textures
     init_textures();
 

mercurial