src/2d.c

changeset 207
4d184a8706b1
parent 206
26726b7a89a7
child 214
9d460888a83e
equal deleted inserted replaced
206:26726b7a89a7 207:4d184a8706b1
187 // when we are drawing an outline but have no explicit border color, 187 // when we are drawing an outline but have no explicit border color,
188 // use the active ink 188 // use the active ink
189 rectangle->border_color = rectangle->color; 189 rectangle->border_color = rectangle->color;
190 } 190 }
191 191
192 AscSceneNode *node = &rectangle->node; 192 asc_ptr_cast(AscSceneNode, node, rectangle);
193 node->position = ASC_VEC3F(pos_x, pos_y, ASC_SCENE_2D_DEPTH_OFFSET); 193 asc_scene_node_init(node,
194 node->scale = ASC_VEC3F_1; 194 ASC_SCENE_NODE_FUNCS(asc_rectangle),
195 asc_mat4f_unit(node->rotation); 195 .pos2d = ASC_VEC2I(pos_x, pos_y),
196 node->render_group = asc_context.ink.alpha < 255 196 .render_group = asc_context.ink.alpha < 255
197 ? ASC_RENDER_GROUP_2D_BLEND 197 ? ASC_RENDER_GROUP_2D_BLEND
198 : ASC_RENDER_GROUP_2D_OPAQUE; 198 : ASC_RENDER_GROUP_2D_OPAQUE
199 node->update_func = asc_rectangle_update; 199 );
200 node->destroy_func = asc_rectangle_destroy;
201 node->draw_func = asc_rectangle_draw;
202 asc_scene_node_update(node);
203 return node; 200 return node;
204 } 201 }
205 202
206 static void asc_ellipsis_destroy(AscSceneNode *node) { 203 static void asc_ellipsis_destroy(AscSceneNode *node) {
207 asc_ptr_cast(AscEllipsis, ellipsis, node); 204 asc_ptr_cast(AscEllipsis, ellipsis, node);
343 // when we are drawing an outline but have no explicit border color, 340 // when we are drawing an outline but have no explicit border color,
344 // use the active ink 341 // use the active ink
345 ellipsis->border_color = ellipsis->color; 342 ellipsis->border_color = ellipsis->color;
346 } 343 }
347 344
348 AscSceneNode *node = &ellipsis->node; 345 asc_ptr_cast(AscSceneNode, node, ellipsis);
349 node->position = ASC_VEC3F(pos_x, pos_y, ASC_SCENE_2D_DEPTH_OFFSET); 346 asc_scene_node_init(node,
350 node->scale = ASC_VEC3F_1; 347 ASC_SCENE_NODE_FUNCS(asc_ellipsis),
351 asc_mat4f_unit(node->rotation); 348 .pos2d = ASC_VEC2I(pos_x, pos_y),
352 node->render_group = asc_context.ink.alpha < 255 349 .render_group = asc_context.ink.alpha < 255
353 ? ASC_RENDER_GROUP_2D_BLEND 350 ? ASC_RENDER_GROUP_2D_BLEND
354 : ASC_RENDER_GROUP_2D_OPAQUE; 351 : ASC_RENDER_GROUP_2D_OPAQUE
355 node->update_func = asc_ellipsis_update; 352 );
356 node->destroy_func = asc_ellipsis_destroy;
357 node->draw_func = asc_ellipsis_draw;
358 asc_scene_node_update(node);
359 return node; 353 return node;
360 } 354 }

mercurial