Mercurial > repos > blastem
comparison render_sdl.c @ 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 | b9564fb88a5a |
children | 8cf57c6558ed |
comparison
equal
deleted
inserted
replaced
904:6bafe1988e8c | 905:b3b399665356 |
---|---|
556 | 556 |
557 char * fps_caption = NULL; | 557 char * fps_caption = NULL; |
558 | 558 |
559 uint32_t frame_counter = 0; | 559 uint32_t frame_counter = 0; |
560 uint32_t start = 0; | 560 uint32_t start = 0; |
561 #ifdef __ANDROID__ | |
562 #define FPS_INTERVAL 10000 | |
563 #else | |
564 #define FPS_INTERVAL 1000 | |
565 #endif | |
561 int wait_render_frame(vdp_context * context, int frame_limit) | 566 int wait_render_frame(vdp_context * context, int frame_limit) |
562 { | 567 { |
563 SDL_Event event; | 568 SDL_Event event; |
564 int ret = 0; | 569 int ret = 0; |
565 while(SDL_PollEvent(&event)) { | 570 while(SDL_PollEvent(&event)) { |
579 } | 584 } |
580 } | 585 } |
581 render_context(context); | 586 render_context(context); |
582 | 587 |
583 frame_counter++; | 588 frame_counter++; |
584 if ((last_frame - start) > 1000) { | 589 if ((last_frame - start) > FPS_INTERVAL) { |
585 if (start && (last_frame-start)) { | 590 if (start && (last_frame-start)) { |
586 if (!fps_caption) { | 591 if (!fps_caption) { |
587 fps_caption = malloc(strlen(caption) + strlen(" - 1000.1 fps") + 1); | 592 fps_caption = malloc(strlen(caption) + strlen(" - 100000000.1 fps") + 1); |
588 } | 593 } |
589 sprintf(fps_caption, "%s - %.1f fps", caption, ((float)frame_counter) / (((float)(last_frame-start)) / 1000.0)); | 594 |
595 #ifdef __ANDROID__ | |
596 info_message("%s - %.1f fps", caption, ((float)frame_counter) / (((float)(last_frame-start)) / (float)FPS_INTERVAL)); | |
597 #else | |
598 sprintf(fps_caption, "%s - %.1f fps", caption, ((float)frame_counter) / (((float)(last_frame-start)) / (float)FPS_INTERVAL)); | |
590 SDL_SetWindowTitle(main_window, fps_caption); | 599 SDL_SetWindowTitle(main_window, fps_caption); |
600 #endif | |
591 } | 601 } |
592 start = last_frame; | 602 start = last_frame; |
593 frame_counter = 0; | 603 frame_counter = 0; |
594 } | 604 } |
595 return ret; | 605 return ret; |