55 asc_gl_context_add_cleanup_func(asc_active_glctx, destroy_textures); |
55 asc_gl_context_add_cleanup_func(asc_active_glctx, destroy_textures); |
56 } |
56 } |
57 |
57 |
58 static void update_fps_counter(AscBehavior *behavior) { |
58 static void update_fps_counter(AscBehavior *behavior) { |
59 AscSceneNode *node = behavior->node; |
59 AscSceneNode *node = behavior->node; |
60 // update text |
60 static float last_fps = 0.f; |
61 static uint64_t last_fps = 0; |
61 if (fabsf(asc_context.frame_rate - last_fps) > 1) { |
62 uint64_t fps = asc_seconds(1) / asc_context.frame_nanos; |
62 last_fps = asc_context.frame_rate; |
63 if (fps != last_fps) { |
63 asc_text_printf(node, "%.2f FPS", asc_context.frame_rate); |
64 last_fps = fps; |
|
65 asc_text_printf(node, "%"PRIu64" FPS", fps); |
|
66 } |
64 } |
67 } |
65 } |
68 |
66 |
69 static void tie_fps_counter_to_corner(AscBehavior *behavior) { |
67 static void tie_fps_counter_to_corner(AscBehavior *behavior) { |
70 // TODO: this should be replaced with some sort of UI layout manager |
68 // TODO: this should be replaced with some sort of UI layout manager |