in show_framerate do not use gr_get_string_size at all but rather use hardcoded coordinates - less CPU-intense

This commit is contained in:
zicodxx 2011-01-22 18:46:08 +01:00
parent da43cc7d37
commit 37f59aa896
2 changed files with 3 additions and 5 deletions

View file

@ -5,6 +5,7 @@ D2X-Rebirth Changelog
main/console.c, main/game.c, main/gamerend.c, main/gauges.c: Added timer_update() to stop/start/reset_time() functions so resumed last_timer_value will be precise; Added new FPS counter which actually does count the frames rendered per second and is less irritating; Added timer_dleay2 call to console to not stress CPU too much; Imporoved placement for show_time(), multi messages, marker messages and orb counts
main/multi.c: Fixed small issue parsing killreactor command in Multiplayer
include/byteswap.h: Added swapping for 64Bit sized integers in case we want to store/read them some day (i.e. new Savegame version storing object instead of object_rw)
main/gamerend.c: in show_framerate do not use gr_get_string_size at all but rather use hardcoded coordinates - less CPU-intense
20110121
--------

View file

@ -101,13 +101,10 @@ void game_draw_multi_message()
void show_framerate()
{
static int fps_count = 0, fps_rate = 0, aw = 0, w = 0, h = 0;
static int fps_count = 0, fps_rate = 0;
int y = GHEIGHT;
static fix64 fps_time = 0;
if (w == 0) // w is static so size will only be calculated once
gr_get_string_size(GameArg.SysMaxFPS>999?"FPS: 0000":"FPS: 000",&w,&h,&aw);
gr_set_curfont(GAME_FONT);
gr_set_fontcolor(BM_XRGB(0,31,0),-1);
@ -135,7 +132,7 @@ void show_framerate()
fps_count = 0;
fps_time = timer_query();
}
gr_printf(SWIDTH-w-FSPACX(1),y,"FPS: %i",fps_rate);
gr_printf(SWIDTH-(GameArg.SysMaxFPS>999?FSPACX(43):FSPACX(37)),y,"FPS: %i",fps_rate);
}
#ifdef NETWORK