Add FPS counter, toggled with [(]
This commit is contained in:
parent
33ec8b4651
commit
977f23a965
6
README
6
README
|
@ -18,15 +18,15 @@ UI improvements TODO:
|
|||
|
||||
WAD support TODO:
|
||||
-> Unmodified 1.9 shareware WAD works all the way through?
|
||||
-> Shareware WAD crashes at the end of E1M3/E1M4 (and in E1M9)
|
||||
-> Ultimate DOOM WAD runs out of memory at the end of E1M2/E1M3
|
||||
-> Shareware WAD from Planète Casio should work 100%
|
||||
-> Ultimate DOOM WAD runs out of memory in E1M6, otherwise should work
|
||||
|
||||
Technical support TODO:
|
||||
-> Supply more VRAM memory to internal allocator
|
||||
=> Merge internal heap into Z_Zone? (< 50 kB)
|
||||
=> Rewrite video code to use long PRAM0 access? (138 kB)
|
||||
=> Use the XRAM/R61524 combo and use VRAM as heap? (160 kB)
|
||||
-> Rate-limit the game when overclocking
|
||||
-> FPS counter on-screen
|
||||
-> Load/Save game would be very cool
|
||||
-> Reenable LTO if possible
|
||||
-> Built-in overclocking?
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "g_game.h"
|
||||
#include "d_main.h"
|
||||
#include "doomstat.h"
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "i_system.h"
|
||||
|
@ -319,6 +320,31 @@ void I_StartTic (void)
|
|||
{
|
||||
static KeyboardState st = { 0 };
|
||||
|
||||
static int fps_show = 0;
|
||||
/* Number of frames since FPS count started */
|
||||
static int fps_frames = 0;
|
||||
/* Time when the FPS count started */
|
||||
static int fps_ticks = -1;
|
||||
|
||||
if(fps_ticks < 0)
|
||||
fps_ticks = RTC_GetTicks();
|
||||
|
||||
if(++fps_frames >= 16)
|
||||
{
|
||||
int now = RTC_GetTicks();
|
||||
int fps = (now == fps_ticks) ? -1 : 128 * fps_frames / (now - fps_ticks);
|
||||
|
||||
if (fps_show)
|
||||
{
|
||||
static char message[16];
|
||||
sprintf(message, "%d FPS", fps);
|
||||
players[consoleplayer].message = message;
|
||||
}
|
||||
|
||||
fps_ticks = now;
|
||||
fps_frames = 0;
|
||||
}
|
||||
|
||||
KeyboardState next_st;
|
||||
ScanKeyboard(next_st);
|
||||
|
||||
|
@ -337,6 +363,8 @@ void I_StartTic (void)
|
|||
CGCycleGamma();
|
||||
if (KeycodePressed(st, next_st, KEYCODE_FD))
|
||||
CGFreeMem();
|
||||
if (KeycodePressed(st, next_st, KEYCODE_LEFTP))
|
||||
fps_show ^= 1;
|
||||
if (KeycodePressed(st, next_st, KEYCODE_VARS))
|
||||
CGRefreshSwitch();
|
||||
|
||||
|
|
Loading…
Reference in New Issue