test/snake/snake.c

changeset 114
5b91bbab1ac0
parent 110
29f8d0d586f8
child 116
bfb2a7d62047
equal deleted inserted replaced
113:71ba88258ea0 114:5b91bbab1ac0
100 } 100 }
101 101
102 static void create_fps_counter(void) { 102 static void create_fps_counter(void) {
103 asc_font(ASC_FONT_REGULAR, 12); 103 asc_font(ASC_FONT_REGULAR, 12);
104 asc_ink_rgba(224, 224, 224, 196); 104 asc_ink_rgba(224, 224, 224, 196);
105 AscSceneNode *node = asc_text(); 105 AscSceneNode *node = asc_text(.name = "FPS Counter");
106 asc_behavior_add(node, .func = update_fps_counter); 106 asc_behavior_add(node, .func = update_fps_counter);
107 asc_add_ui_node(node); 107 asc_add_ui_node(node);
108 } 108 }
109 109
110 static void create_score_counter(void) { 110 static void create_score_counter(void) {
111 asc_font(ASC_FONT_BOLD, 16); 111 asc_font(ASC_FONT_BOLD, 16);
112 asc_ink_rgb(0, 255, 0); 112 asc_ink_rgb(0, 255, 0);
113 AscSceneNode* node = asc_text( 113 AscSceneNode* node = asc_text(
114 .x = 10, .y = 10, 114 .name = "Score Counter",
115 .text = "Score: 0" 115 .x = 10, .y = 10,
116 .text = "Score: 0"
116 ); 117 );
117 asc_add_ui_node(node); 118 asc_add_ui_node(node);
118 } 119 }
119 120
120 static void create_spaceship(void) { 121 static void create_spaceship(void) {
121 AscSceneNode *sprite = asc_sprite( 122 AscSceneNode *sprite = asc_sprite(
123 .name = "Player",
122 .texture = TEXTURE_SHIP, 124 .texture = TEXTURE_SHIP,
123 .x = 250, 125 .x = 250,
124 .y = 300, 126 .y = 300,
125 .width = 64, 127 .width = 64,
126 .height = 64 128 .height = 64

mercurial