Signed-off-by: terencehill <piuntn@gmail.com>
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10494
d7cf8633-e32d-0410-b094-
e92efae38249
void Sbar_ShowFPS(void)
{
void Sbar_ShowFPS(void)
{
- float fps_x, fps_y, fps_scalex, fps_scaley, fps_height;
+ float fps_x, fps_y, fps_scalex, fps_scaley, fps_strings = 0;
char soundstring[32];
char fpsstring[32];
char timestring[32];
char soundstring[32];
char fpsstring[32];
char timestring[32];
dpsnprintf(fpsstring, sizeof(fpsstring), "%4i spf", (int)(1.0 / showfps_framerate + 0.5));
else
dpsnprintf(fpsstring, sizeof(fpsstring), "%4i fps", (int)(showfps_framerate + 0.5));
dpsnprintf(fpsstring, sizeof(fpsstring), "%4i spf", (int)(1.0 / showfps_framerate + 0.5));
else
dpsnprintf(fpsstring, sizeof(fpsstring), "%4i fps", (int)(showfps_framerate + 0.5));
if (cls.timedemo)
{
dpsnprintf(timedemostring1, sizeof(timedemostring1), "frame%4i %f", cls.td_frames, realtime - cls.td_starttime);
dpsnprintf(timedemostring2, sizeof(timedemostring2), "%i seconds %3.0f/%3.0f/%3.0f fps", cls.td_onesecondavgcount, cls.td_onesecondminfps, cls.td_onesecondavgfps / max(1, cls.td_onesecondavgcount), cls.td_onesecondmaxfps);
if (cls.timedemo)
{
dpsnprintf(timedemostring1, sizeof(timedemostring1), "frame%4i %f", cls.td_frames, realtime - cls.td_starttime);
dpsnprintf(timedemostring2, sizeof(timedemostring2), "%i seconds %3.0f/%3.0f/%3.0f fps", cls.td_onesecondavgcount, cls.td_onesecondminfps, cls.td_onesecondavgfps / max(1, cls.td_onesecondavgcount), cls.td_onesecondmaxfps);
+ fps_strings++;
+ fps_strings++;
}
}
if (showtime.integer)
}
}
if (showtime.integer)
strlcpy(timestring, Sys_TimeString(showtime_format.string), sizeof(timestring));
strlcpy(timestring, Sys_TimeString(showtime_format.string), sizeof(timestring));
strlcpy(datestring, Sys_TimeString(showdate_format.string), sizeof(datestring));
strlcpy(datestring, Sys_TimeString(showdate_format.string), sizeof(datestring));
dpsnprintf(blurstring, sizeof(blurstring), "%3i%% blur", (int)(cl.motionbluralpha * 100));
dpsnprintf(blurstring, sizeof(blurstring), "%3i%% blur", (int)(cl.motionbluralpha * 100));
dpsnprintf(soundstring, sizeof(soundstring), "%4i/4%i at %3ims", cls.soundstats.mixedsounds, cls.soundstats.totalsounds, cls.soundstats.latency_milliseconds);
dpsnprintf(soundstring, sizeof(soundstring), "%4i/4%i at %3ims", cls.soundstats.mixedsounds, cls.soundstats.totalsounds, cls.soundstats.latency_milliseconds);
if (showspeed.integer || showtopspeed.integer)
{
double speed, speedxy, f;
if (showspeed.integer || showtopspeed.integer)
{
double speed, speedxy, f;
{
get_showspeed_unit(showspeed.integer, &f, &unit);
dpsnprintf(speedstring, sizeof(speedstring), "%.0f (%.0f) %s", f*speed, f*speedxy, unit);
{
get_showspeed_unit(showspeed.integer, &f, &unit);
dpsnprintf(speedstring, sizeof(speedstring), "%.0f (%.0f) %s", f*speed, f*speedxy, unit);
}
if (showtopspeed.integer)
{
}
if (showtopspeed.integer)
{
topspeedxy_latched ? "^1" : "^xf88", f*topspeedxy, "^xf88",
unit);
time(¤t_time);
topspeedxy_latched ? "^1" : "^xf88", f*topspeedxy, "^xf88",
unit);
time(¤t_time);
- if (fpsstring[0] || timedemostring1[0] || timedemostring2[0] || timestring[0] || datestring[0] || speedstring[0] || blurstring[0] || topspeedstring[0])
{
fps_scalex = 12;
fps_scaley = 12;
{
fps_scalex = 12;
fps_scaley = 12;
- fps_height = fps_scaley * ((soundstring[0] != 0) + (blurstring[0] != 0) + (fpsstring[0] != 0) + (timedemostring1[0] != 0) + (timedemostring2[0] != 0) + (timestring[0] != 0) + (datestring[0] != 0) + (speedstring[0] != 0) + (topspeedstring[0] != 0));
//fps_y = vid_conheight.integer - sb_lines; // yes this may draw over the sbar
//fps_y = vid_conheight.integer - sb_lines; // yes this may draw over the sbar
- //fps_y = bound(0, fps_y, vid_conheight.integer - fps_height);
- fps_y = vid_conheight.integer - sbar_info_pos.integer - fps_height;
+ //fps_y = bound(0, fps_y, vid_conheight.integer - fps_strings*fps_scaley);
+ fps_y = vid_conheight.integer - sbar_info_pos.integer - fps_strings*fps_scaley;
if (soundstring[0])
{
fps_x = vid_conwidth.integer - DrawQ_TextWidth(soundstring, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);
if (soundstring[0])
{
fps_x = vid_conwidth.integer - DrawQ_TextWidth(soundstring, 0, fps_scalex, fps_scaley, true, FONT_INFOBAR);