From fb572183c84e136f2b1c9f095b96a8a341d04b6b Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sat, 28 Nov 2015 14:49:34 -0800 Subject: Don't try setting the window title on Android --- render_sdl.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'render_sdl.c') diff --git a/render_sdl.c b/render_sdl.c index f81c715..bfa1451 100755 --- a/render_sdl.c +++ b/render_sdl.c @@ -558,6 +558,11 @@ char * fps_caption = NULL; uint32_t frame_counter = 0; uint32_t start = 0; +#ifdef __ANDROID__ +#define FPS_INTERVAL 10000 +#else +#define FPS_INTERVAL 1000 +#endif int wait_render_frame(vdp_context * context, int frame_limit) { SDL_Event event; @@ -581,13 +586,18 @@ int wait_render_frame(vdp_context * context, int frame_limit) render_context(context); frame_counter++; - if ((last_frame - start) > 1000) { + if ((last_frame - start) > FPS_INTERVAL) { if (start && (last_frame-start)) { if (!fps_caption) { - fps_caption = malloc(strlen(caption) + strlen(" - 1000.1 fps") + 1); + fps_caption = malloc(strlen(caption) + strlen(" - 100000000.1 fps") + 1); } - sprintf(fps_caption, "%s - %.1f fps", caption, ((float)frame_counter) / (((float)(last_frame-start)) / 1000.0)); + +#ifdef __ANDROID__ + info_message("%s - %.1f fps", caption, ((float)frame_counter) / (((float)(last_frame-start)) / (float)FPS_INTERVAL)); +#else + sprintf(fps_caption, "%s - %.1f fps", caption, ((float)frame_counter) / (((float)(last_frame-start)) / (float)FPS_INTERVAL)); SDL_SetWindowTitle(main_window, fps_caption); +#endif } start = last_frame; frame_counter = 0; -- cgit v1.2.3