src/text.c

changeset 209
90fc22696e94
parent 208
658bccb1bf73
child 212
90bbacb97cb6
equal deleted inserted replaced
208:658bccb1bf73 209:90fc22696e94
148 148
149 AscSceneNode *asc_text_create(struct asc_text_create_args args) { 149 AscSceneNode *asc_text_create(struct asc_text_create_args args) {
150 AscText *text = cxZallocDefault(sizeof(AscText)); 150 AscText *text = cxZallocDefault(sizeof(AscText));
151 asc_ptr_cast(AscSceneNode, node, text); 151 asc_ptr_cast(AscSceneNode, node, text);
152 152
153 // node properties
154 asc_scene_node_init(node,
155 ASC_SCENE_NODE_FUNCS(asc_text),
156 .name = args.name,
157 .render_group = ASC_RENDER_GROUP_2D_BLEND,
158 .pos2d = ASC_VEC2I(args.x, args.y)
159 );
160
161 // text properties 153 // text properties
162 node->flags = args.alignment; // use flags variable to save some space 154 node->flags = args.alignment; // use flags variable to save some space
163 text->max_width = args.max_width; 155 text->max_width = args.max_width;
164 text->font = asc_active_font; 156 text->font = asc_active_font;
165 text->color = asc_context.ink; 157 text->color = asc_context.ink;
174 166
175 // initialize texture 167 // initialize texture
176 // mesh will be created in the update func 168 // mesh will be created in the update func
177 text->texture = cxMallocDefault(sizeof(AscTexture)); 169 text->texture = cxMallocDefault(sizeof(AscTexture));
178 asc_texture_init_rectangle(text->texture, 1); 170 asc_texture_init_rectangle(text->texture, 1);
179 // TODO: check why we can't just wait for the first normal update to happen 171
180 //asc_text_update(node); 172 // basic node properties
173 asc_scene_node_init(node,
174 ASC_SCENE_NODE_FUNCS(asc_text),
175 .name = args.name,
176 .render_group = ASC_RENDER_GROUP_2D_BLEND,
177 .pos2d = ASC_VEC2I(args.x, args.y)
178 );
181 179
182 return node; 180 return node;
183 } 181 }
184 182
185 void asc_text_alignment( 183 void asc_text_alignment(

mercurial