summaryrefslogtreecommitdiff
path: root/render_sdl.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2015-11-28 14:49:34 -0800
committerMichael Pavone <pavone@retrodev.com>2015-11-28 14:49:34 -0800
commitfb572183c84e136f2b1c9f095b96a8a341d04b6b (patch)
tree004bb6378f83b6964ee53304ff7b8e1ca7b9badd /render_sdl.c
parentcff435e9c37af90a3c3a339ffd7cf189067ac8b7 (diff)
Don't try setting the window title on Android
Diffstat (limited to 'render_sdl.c')
-rwxr-xr-xrender_sdl.c16
1 files changed, 13 insertions, 3 deletions
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;