test/snake/snake.c

changeset 204
be5cf64b5c29
parent 200
cf0579d3bbc4
child 205
d1e44c861426
--- a/test/snake/snake.c	Sun Jul 13 14:22:40 2025 +0200
+++ b/test/snake/snake.c	Sun Jul 13 15:09:04 2025 +0200
@@ -70,13 +70,10 @@
     if (asc_test_flag(node->flags, ASC_SCENE_NODE_GRAPHICS_UPDATED) || asc_active_window->resized) {
         asc_vec2u bottom_right = asc_active_window->dimensions;
         asc_vec2u text_size = ((AscText*)node)->dimension;
-        asc_transform new_transform;
-        asc_transform_identity(new_transform);
-        asc_transform_translate2f(new_transform, ASC_VEC2F(
+        asc_node_set_position2f(node, ASC_VEC2F(
                 (int) bottom_right.x - (int) text_size.width - 10,
                 (int) bottom_right.y - (int) text_size.height - 10
         ));
-        asc_node_transform_set(node, new_transform);
     }
 }
 
@@ -125,7 +122,9 @@
         .x = 250,
         .y = 300,
         .width = 64,
-        .height = 64
+        .height = 64,
+        .origin_x = 32,
+        .origin_y = 32,
     );
     asc_scene_add_node(MAIN_SCENE, sprite);
     return sprite;
@@ -208,7 +207,7 @@
 
         // player rotation
         if (asc_key_pressed(ASC_KEY(LEFT))) {
-            asc_transform_roll_origin(spaceship->transform, asc_rad(-90), ASC_VEC3F(32, 32, 0));
+            asc_node_roll_deg(spaceship, -90);
             asc_node_update_transform(spaceship);
         }
 

mercurial