test/snake/snake.c

changeset 263
cc5cd4c98e46
parent 262
b47de42f4598
child 264
653869cd653f
--- a/test/snake/snake.c	Tue Aug 12 21:04:59 2025 +0200
+++ b/test/snake/snake.c	Wed Aug 13 23:49:39 2025 +0200
@@ -127,7 +127,7 @@
 }
 
 static void backdrop_create(void) {
-    const float scale = asc_active_window->ui_scale;
+    const float scale = 1.f / asc_active_window->ui_scale;
     AscSceneNode *node = asc_sprite(
         .texture = TEXTURE_BACKDROP,
         .texture_scale_mode = ASC_TEXTURE_SCALE_REPEAT,
@@ -466,11 +466,14 @@
     // load textures
     textures_init();
 
-    // initialize the scenes
+    // initialize backdrop scene
     asc_scene_init(BACKDROP_SCENE, "backdrop",
         .type = ASC_CAMERA_ORTHO,
         .projection_update_func = asc_camera_ortho_update_size
     );
+    backdrop_create();
+
+    // Initialize main scene
     asc_scene_init(MAIN_SCENE, "main",
         .type = ASC_CAMERA_ORTHO,
         .ortho.rect = ASC_RECT(
@@ -483,7 +486,6 @@
         .clear_color = ASC_RGBi(0, 32, 16),
         .viewport_update_func = main_scene_viewport_update
     );
-    backdrop_create();
 
     // create the fps counter
     AscSceneNode *fps_counter = fps_counter_create();

mercurial