Permalink
Browse files

Move FPS to right side and low

Mako88 requests, as have others in the Rebirth forum, that the FPS
indicator be placed on the right side.  Moving to the right side was
quick.  Moving it low, handling all the different rendering combinations
(cockpit, statusbar, fullscreen; standard vs alternate; single player vs
multiplayer), and not overlapping anything in any of them was time
consuming.

If anyone wants more changes in this area, the existing modes ought to
be revisited and unified.  As is, there are pointless inconsistencies
among the modes, which makes it unnecessarily difficult to position an
element correctly.

Requested-by: Mako88 <#122>
  • Loading branch information...
vLKp committed Apr 14, 2018
1 parent 8096af9 commit 48b31d84f3448da05315ea6f734322be792441b1
Showing with 52 additions and 15 deletions.
  1. +48 −11 similar/main/gamerend.cpp
  2. +4 −4 similar/main/gauges.cpp
@@ -111,23 +111,60 @@ static void show_framerate(grs_canvas &canvas)
{
static int fps_count = 0, fps_rate = 0;
static fix64 fps_time = 0;
gr_set_curfont(canvas, GAME_FONT);
gr_set_fontcolor(canvas, BM_XRGB(0, 31, 0),-1);
fps_count++;
if (timer_query() >= fps_time + F1_0)
const auto tq = timer_query();
if (tq >= fps_time + F1_0)
{
fps_rate = fps_count;
fps_count = 0;
fps_time = timer_query();
fps_time = tq;
}
const auto &&line_spacing = LINE_SPACING(canvas);
unsigned line_displacement;
switch (PlayerCfg.CockpitMode[1])
{
case CM_FULL_COCKPIT:
line_displacement = line_spacing * 2;
break;
case CM_STATUS_BAR:
line_displacement = line_spacing;
break;
case CM_FULL_SCREEN:
switch (PlayerCfg.HudMode)
{
case HudType::Standard:
line_displacement = line_spacing * 4;
break;
case HudType::Alternate1:
line_displacement = line_spacing * 6;
if (Game_mode & GM_MULTI)
line_displacement -= line_spacing * 4;
break;
case HudType::Alternate2:
line_displacement = line_spacing;
break;
case HudType::Hidden:
default:
return;
}
break;
case CM_LETTERBOX:
case CM_REAR_VIEW:
default:
return;
}
const auto &&fspacx2 = FSPACX(2);
const auto &&y = LINE_SPACING(canvas) * 16;
const auto &game_font = *GAME_FONT;
gr_set_curfont(canvas, &game_font);
gr_set_fontcolor(canvas, BM_XRGB(0, 31, 0),-1);
char buf[16];
if (CGameArg.DbgVerbose)
gr_printf(canvas, fspacx2, y, "%iFPS (%.2fms)", fps_rate, (static_cast<float>(1000) / (F1_0 / FrameTime)));
else
gr_printf(canvas, fspacx2, y, "%iFPS", fps_rate);
snprintf(buf, sizeof(buf), "%iFPS (%.2fms)", fps_rate, (FrameTime * 1000.) / F1_0);
else
snprintf(buf, sizeof(buf), "%iFPS", fps_rate);
int w, h;
gr_get_string_size(game_font, buf, &w, &h, nullptr);
const auto bm_h = canvas.cv_bitmap.bm_h;
gr_string(canvas, FSPACX(318) - w, bm_h - line_displacement, buf, w, h);
}
}
@@ -1330,9 +1330,9 @@ static void hud_show_primary_weapons_mode(grs_canvas &canvas, const player_info
txtweapon = "P";
break;
case primary_weapon_index_t::OMEGA_INDEX:
if (PlayerCfg.CockpitMode[1]==CM_FULL_SCREEN)
if (PlayerCfg.CockpitMode[1] == CM_FULL_SCREEN && (player_info.primary_weapon_flags & HAS_OMEGA_FLAG))
{
snprintf(weapon_str, sizeof(weapon_str), "O%03i", player_info.Omega_charge * 100 / MAX_OMEGA_CHARGE);
snprintf(weapon_str, sizeof(weapon_str), "O%3i", player_info.Omega_charge * 100 / MAX_OMEGA_CHARGE);
txtweapon = weapon_str;
}
else
@@ -1442,9 +1442,9 @@ static void hud_show_weapons(grs_canvas &canvas, const object &plrobj)
if (PlayerCfg.HudMode == HudType::Alternate1)
{
#if defined(DXX_BUILD_DESCENT_I)
unsigned multiplier = 1;
constexpr unsigned multiplier = 1;
#elif defined(DXX_BUILD_DESCENT_II)
unsigned multiplier = 2;
constexpr unsigned multiplier = 2;
#endif
hud_show_primary_weapons_mode(canvas, player_info, 0, canvas.cv_bitmap.bm_w, y - (line_spacing * 2 * multiplier));
hud_show_secondary_weapons_mode(canvas, player_info, 0, canvas.cv_bitmap.bm_w, y - (line_spacing * multiplier));

0 comments on commit 48b31d8

Please sign in to comment.