51 ); |
51 ); |
52 if (surface == NULL) { |
52 if (surface == NULL) { |
53 asc_error("Rendering TTF surface failed: %s", SDL_GetError()); |
53 asc_error("Rendering TTF surface failed: %s", SDL_GetError()); |
54 return; |
54 return; |
55 } |
55 } |
56 asc_set_scale2d(node, surface->w, surface->h); |
56 // TODO: don't use scale - create an own fitting mesh |
|
57 asc_set_scale(node, (float)surface->w, (float)surface->h, 1.f); |
57 if (asc_test_flag(text->base.data.flags, ASC_TEXT_CENTERED_FLAG)) { |
58 if (asc_test_flag(text->base.data.flags, ASC_TEXT_CENTERED_FLAG)) { |
58 unsigned short newoffx = surface->w / 2; |
59 unsigned short newoffx = surface->w / 2; |
59 asc_vec2i pos = asc_get_position2d(node); |
60 asc_vec2i pos = asc_get_position2d(node); |
60 asc_set_position2d(node, pos.x + text->offx - newoffx, pos.y); |
61 asc_set_position2d(node, pos.x + text->offx - newoffx, pos.y); |
61 text->offx = newoffx; |
62 text->offx = newoffx; |
85 node->render_group = ASC_RENDER_GROUP_SPRITE_BLEND; |
86 node->render_group = ASC_RENDER_GROUP_SPRITE_BLEND; |
86 node->free_func = asc_text_free; |
87 node->free_func = asc_text_free; |
87 node->update_func = asc_text_update; |
88 node->update_func = asc_text_update; |
88 |
89 |
89 node->flags = args.alignment; |
90 node->flags = args.alignment; |
90 node->position.x = (float) args.x; |
91 node->position = asc_vec3f_new(args.x, args.y, ASC_SCENE_2D_DEPTH_OFFSET); |
91 node->position.y = (float) args.y; |
|
92 node->position.z = ASC_SCENE_2D_DEPTH_OFFSET; |
|
93 node->scale.depth = 1.f; |
92 node->scale.depth = 1.f; |
94 text->max_width = args.max_width; |
93 text->max_width = args.max_width; |
95 text->font = asc_active_font; |
94 text->font = asc_active_font; |
96 text->color = asc_context.ink; |
95 text->color = asc_context.ink; |
97 if (args.text == NULL) { |
96 if (args.text == NULL) { |