demo/snake/snake.c

changeset 300
22b232e3202a
parent 299
c0d3a1acc6ae
equal deleted inserted replaced
299:c0d3a1acc6ae 300:22b232e3202a
169 asc_ui_add_node(frame); 169 asc_ui_add_node(frame);
170 } 170 }
171 171
172 static void fps_counter_update(AscBehavior *behavior) { 172 static void fps_counter_update(AscBehavior *behavior) {
173 asc_ptr_cast(AscText, node, behavior->node); 173 asc_ptr_cast(AscText, node, behavior->node);
174 static float last_fps = 0.f; 174 asc_text_printf(node,
175 if (fabsf(asc_context.frame_rate - last_fps) > 1) { 175 "%.2f FPS\n"
176 last_fps = asc_context.frame_rate; 176 "%llu draw calls\n"
177 asc_text_printf(node, 177 "%llu triangles\n"
178 "%.2f FPS\n" 178 "%llu vertices",
179 "%llu draw calls\n" 179 asc_context.frame_rate,
180 "%llu triangles\n" 180 asc_active_glctx->counters.draw_calls,
181 "%llu vertices", 181 asc_active_glctx->counters.triangles_rendered,
182 asc_context.frame_rate, 182 asc_active_glctx->counters.vertices_rendered);
183 asc_active_glctx->counters.draw_calls,
184 asc_active_glctx->counters.triangles_rendered,
185 asc_active_glctx->counters.vertices_rendered);
186 }
187 } 183 }
188 184
189 static void fps_counter_tie_to_corner(AscBehavior *behavior) { 185 static void fps_counter_tie_to_corner(AscBehavior *behavior) {
190 // TODO: this should be replaced with some sort of UI layout manager 186 // TODO: this should be replaced with some sort of UI layout manager
191 AscSceneNode *node = behavior->node; 187 AscSceneNode *node = behavior->node;

mercurial