--- a/src/text.c Sun Jul 13 14:22:40 2025 +0200 +++ b/src/text.c Sun Jul 13 15:09:04 2025 +0200 @@ -86,9 +86,7 @@ return; } if (asc_test_flag(text->base.flags, ASC_TEXT_CENTERED_FLAG)) { - unsigned short newoffx = surface->w / 2; - asc_transform_translate2f(node->transform, ASC_VEC2F(text->offx - newoffx, 0)); - text->offx = newoffx; + asc_node_set_origin(node, ASC_VEC3F(surface->w / 2, 0, 0)); } // Transfer Image Data @@ -151,9 +149,9 @@ node->destroy_func = asc_text_destroy; node->update_func = asc_text_update; node->draw_func = asc_text_draw; - asc_transform_identity(node->transform); - asc_transform_translate3f(node->transform, - ASC_VEC3F(args.x, args.y, ASC_SCENE_2D_DEPTH_OFFSET)); + node->position = ASC_VEC3F(args.x, args.y, ASC_SCENE_2D_DEPTH_OFFSET); + node->scale = ASC_VEC3F_1; + asc_mat4f_unit(node->rotation); // text properties node->flags = args.alignment; // use flags variable to save some space @@ -165,6 +163,9 @@ } else { text->text = cx_mutstr(strdup(args.text)); } + if (args.centered) { + asc_set_flag(node->flags, ASC_TEXT_CENTERED_FLAG); + } // initialize texture // mesh will be created in the update func