From 37f59aa896d30cdfa8b3764183fb02f24d3ad154 Mon Sep 17 00:00:00 2001 From: zicodxx Date: Sat, 22 Jan 2011 18:46:08 +0100 Subject: [PATCH] in show_framerate do not use gr_get_string_size at all but rather use hardcoded coordinates - less CPU-intense --- CHANGELOG.txt | 1 + main/gamerend.c | 7 ++----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 912c7ba5b..c595755eb 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 -------- diff --git a/main/gamerend.c b/main/gamerend.c index 7c9c205ed..b00ff30e6 100644 --- a/main/gamerend.c +++ b/main/gamerend.c @@ -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