test/snake.c

changeset 47
44457f6cb0a2
parent 46
d3285aed65b3
child 48
6e5b5ba2752c
equal deleted inserted replaced
46:d3285aed65b3 47:44457f6cb0a2
48 static void create_fps_counter(void) { 48 static void create_fps_counter(void) {
49 asc_set_font(asc_font(ASC_FONT_REGULAR, 24)); 49 asc_set_font(asc_font(ASC_FONT_REGULAR, 24));
50 asc_ink_rgb(255, 0, 0); 50 asc_ink_rgb(255, 0, 0);
51 AscSceneNode* node = asc_text(10, 10, "XXXXXXX FPS"); 51 AscSceneNode* node = asc_text(10, 10, "XXXXXXX FPS");
52 asc_scene_add_behavior(node, update_fps_counter); 52 asc_scene_add_behavior(node, update_fps_counter);
53 asc_scene_add(&asc_window_active->ui, node); 53 asc_scene_node_link(asc_window_active->ui, node);
54 } 54 }
55 55
56 static void update_score_counter(AscSceneNode *node) { 56 static void update_score_counter(AscSceneNode *node) {
57 // tie to bottom left of the screen 57 // tie to bottom left of the screen
58 if (asc_window_active->resized) { 58 if (asc_window_active->resized) {
69 static void create_score_counter(void) { 69 static void create_score_counter(void) {
70 asc_set_font(asc_font(ASC_FONT_BOLD, 14)); 70 asc_set_font(asc_font(ASC_FONT_BOLD, 14));
71 asc_ink_rgb(0, 255, 0); 71 asc_ink_rgb(0, 255, 0);
72 AscSceneNode* node = asc_text(0, 0, "Score: 0"); 72 AscSceneNode* node = asc_text(0, 0, "Score: 0");
73 asc_scene_add_behavior(node, update_score_counter); 73 asc_scene_add_behavior(node, update_score_counter);
74 asc_scene_add(&asc_window_active->ui, node); 74 asc_scene_node_link(asc_window_active->ui, node);
75 } 75 }
76 76
77 int main(int argc, char** argv) { 77 int main(int argc, char** argv) {
78 asc_context_initialize(); 78 asc_context_initialize();
79 if (asc_has_error()) { 79 if (asc_has_error()) {

mercurial