src/text.c

changeset 189
2c063b225183
parent 176
cb2f60f48337
child 193
ddf690c0b36b
--- a/src/text.c	Mon Jul 07 22:41:48 2025 +0200
+++ b/src/text.c	Mon Jul 07 22:51:06 2025 +0200
@@ -57,7 +57,7 @@
     }
     if (asc_test_flag(text->base.data.flags, ASC_TEXT_CENTERED_FLAG)) {
         unsigned short newoffx = surface->w / 2;
-        node->position.x = node->position.x + (float)(text->offx - newoffx);
+        asc_transform_translate2f(node->transform, ASC_VEC2F(text->offx - newoffx, 0));
         text->offx = newoffx;
     }
 
@@ -102,8 +102,9 @@
     node->destroy_func = asc_text_destroy;
     node->update_func = asc_text_update;
     node->draw_func = asc_sprite_draw;
-    node->position = ASC_VEC3F(args.x, args.y, ASC_SCENE_2D_DEPTH_OFFSET);
-    node->scale = ASC_VEC3F_1;
+    asc_transform_identity(node->transform);
+    asc_transform_translate3f(node->transform,
+        ASC_VEC3F(args.x, args.y, ASC_SCENE_2D_DEPTH_OFFSET));
 
     // text properties
     node->flags = args.alignment; // use flags variable to save some space

mercurial