55 asc_error("Rendering TTF surface failed: %s", SDL_GetError()); |
55 asc_error("Rendering TTF surface failed: %s", SDL_GetError()); |
56 return; |
56 return; |
57 } |
57 } |
58 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)) { |
59 unsigned short newoffx = surface->w / 2; |
59 unsigned short newoffx = surface->w / 2; |
60 node->position.x = node->position.x + (float)(text->offx - newoffx); |
60 asc_transform_translate2f(node->transform, ASC_VEC2F(text->offx - newoffx, 0)); |
61 text->offx = newoffx; |
61 text->offx = newoffx; |
62 } |
62 } |
63 |
63 |
64 // Transfer Image Data |
64 // Transfer Image Data |
65 asc_texture_from_surface(sprite->texture, surface); |
65 asc_texture_from_surface(sprite->texture, surface); |
100 asc_scene_node_name(node, args.name); |
100 asc_scene_node_name(node, args.name); |
101 node->render_group = ASC_RENDER_GROUP_2D_BLEND; |
101 node->render_group = ASC_RENDER_GROUP_2D_BLEND; |
102 node->destroy_func = asc_text_destroy; |
102 node->destroy_func = asc_text_destroy; |
103 node->update_func = asc_text_update; |
103 node->update_func = asc_text_update; |
104 node->draw_func = asc_sprite_draw; |
104 node->draw_func = asc_sprite_draw; |
105 node->position = ASC_VEC3F(args.x, args.y, ASC_SCENE_2D_DEPTH_OFFSET); |
105 asc_transform_identity(node->transform); |
106 node->scale = ASC_VEC3F_1; |
106 asc_transform_translate3f(node->transform, |
|
107 ASC_VEC3F(args.x, args.y, ASC_SCENE_2D_DEPTH_OFFSET)); |
107 |
108 |
108 // text properties |
109 // text properties |
109 node->flags = args.alignment; // use flags variable to save some space |
110 node->flags = args.alignment; // use flags variable to save some space |
110 text->max_width = args.max_width; |
111 text->max_width = args.max_width; |
111 text->font = asc_active_font; |
112 text->font = asc_active_font; |