changeset 905:b3b399665356

Don't try setting the window title on Android
author Michael Pavone <pavone@retrodev.com>
date Sat, 28 Nov 2015 14:49:34 -0800
parents 6bafe1988e8c
children 8cf57c6558ed
files render_sdl.c
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/render_sdl.c	Sat Nov 28 14:32:55 2015 -0800
+++ b/render_sdl.c	Sat Nov 28 14:49:34 2015 -0800
@@ -558,6 +558,11 @@
 
 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 @@
 	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;