test/snake.c

changeset 45
18de2af03531
parent 44
b3da4096c607
child 46
d3285aed65b3
equal deleted inserted replaced
44:b3da4096c607 45:18de2af03531
53 asc_scene_add_behavior(node, update_fps_counter); 53 asc_scene_add_behavior(node, update_fps_counter);
54 asc_scene_add(&asc_window_active->ui, node); 54 asc_scene_add(&asc_window_active->ui, node);
55 } 55 }
56 56
57 static void update_score_counter(AscSceneNode *node) { 57 static void update_score_counter(AscSceneNode *node) {
58 AscText *text = asc_text_data(node);
59
60 // tie to bottom left of the screen 58 // tie to bottom left of the screen
61 if (asc_window_active->resized) { 59 if (asc_window_active->resized) {
62 asc_vec2i bottom_left = asc_window_active->dimensions; 60 asc_vec2i bottom_left = asc_window_active->dimensions;
63 text->position.x = bottom_left.x - text->dimension.width - 10; 61 asc_vec2i scale = asc_get_scale2d(node);
64 text->position.y = bottom_left.y - text->dimension.height - 10; 62 asc_set_position2d(
65 asc_node_update_transform(text); 63 node,
64 bottom_left.x - scale.width - 10,
65 bottom_left.y - scale.height - 10
66 );
66 } 67 }
67 } 68 }
68 69
69 static void create_score_counter(void) { 70 static void create_score_counter(void) {
70 asc_set_font(asc_font(ASC_FONT_BOLD, 14)); 71 asc_set_font(asc_font(ASC_FONT_BOLD, 14));

mercurial