src/text.c

changeset 175
e5544920377e
parent 162
d3598c834f9b
equal deleted inserted replaced
174:0009b982bc7d 175:e5544920377e
66 66
67 // If dimensions changed, update the mesh 67 // If dimensions changed, update the mesh
68 if (text->dimension.x != (unsigned)surface->w || text->dimension.y != (unsigned)surface->h) { 68 if (text->dimension.x != (unsigned)surface->w || text->dimension.y != (unsigned)surface->h) {
69 text->dimension.x = surface->w; 69 text->dimension.x = surface->w;
70 text->dimension.y = surface->h; 70 text->dimension.y = surface->h;
71 const asc_vec2f uv_scale = asc_texture_calculate_uv_scale(sprite->texture, text->dimension, asc_vec2f_one); 71 const asc_vec2f uv_scale = asc_texture_calculate_uv_scale(sprite->texture, text->dimension, ASC_VEC2F_1);
72 asc_mesh_plane_2d(&text->base.mesh, 72 asc_mesh_plane_2d(&text->base.mesh,
73 .size = asc_vec2f_new(surface->w, surface->h), 73 .size = ASC_VEC2F(surface->w, surface->h),
74 .uv_scale = uv_scale 74 .uv_scale = uv_scale
75 ); 75 );
76 } 76 }
77 77
78 // Free the surface 78 // Free the 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_new(args.x, args.y, ASC_SCENE_2D_DEPTH_OFFSET); 105 node->position = ASC_VEC3F(args.x, args.y, ASC_SCENE_2D_DEPTH_OFFSET);
106 node->scale = asc_vec3f_one; 106 node->scale = ASC_VEC3F_1;
107 107
108 // text properties 108 // text properties
109 node->flags = args.alignment; // use flags variable to save some space 109 node->flags = args.alignment; // use flags variable to save some space
110 text->max_width = args.max_width; 110 text->max_width = args.max_width;
111 text->font = asc_active_font; 111 text->font = asc_active_font;

mercurial