test/snake.c

changeset 45
18de2af03531
parent 44
b3da4096c607
child 46
d3285aed65b3
--- a/test/snake.c	Tue Mar 26 20:37:21 2024 +0100
+++ b/test/snake.c	Thu Mar 28 23:30:21 2024 +0100
@@ -55,14 +55,15 @@
 }
 
 static void update_score_counter(AscSceneNode *node) {
-    AscText *text = asc_text_data(node);
-
     // tie to bottom left of the screen
     if (asc_window_active->resized) {
         asc_vec2i bottom_left = asc_window_active->dimensions;
-        text->position.x = bottom_left.x - text->dimension.width - 10;
-        text->position.y = bottom_left.y - text->dimension.height - 10;
-        asc_node_update_transform(text);
+        asc_vec2i scale = asc_get_scale2d(node);
+        asc_set_position2d(
+                node,
+                bottom_left.x - scale.width - 10,
+                bottom_left.y - scale.height - 10
+        );
     }
 }
 

mercurial