Skip to content

Commit

Permalink
Show the FPS counter using decimals instead of integers.
Browse files Browse the repository at this point in the history
  • Loading branch information
Arignir committed Aug 3, 2024
1 parent d3bdf07 commit 15567fa
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/app/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ struct app {
bool is_running;

// Current FPS
uint32_t fps;
float fps;

// The current quicksave request
struct {
Expand Down
2 changes: 1 addition & 1 deletion source/app/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ main(

now = SDL_GetTicks();
if ((now - app.ui.ticks_last_frame) >= 1000) {
app.emulation.fps = gba_shared_reset_frame_counter(app.emulation.gba);
app.emulation.fps = gba_shared_reset_frame_counter(app.emulation.gba) / (float)(now - app.ui.ticks_last_frame) * 1000.0;
app.ui.ticks_last_frame = now;

/*
Expand Down
2 changes: 1 addition & 1 deletion source/app/windows/menubar.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ app_win_menubar_fps_counter(
spacing = igGetStyle()->ItemSpacing.x;

igSameLine(igGetWindowWidth() - (app->ui.menubar_fps_width + spacing * 2), 1);
igText("FPS: %u (%u%%)", app->emulation.fps, (unsigned)(app->emulation.fps / 60.0 * 100.0));
igText("FPS: %.1f (%.1f%%)", app->emulation.fps, app->emulation.fps / 60.0 * 100.0);
igGetItemRectSize(&out);
app->ui.menubar_fps_width = out.x;
}
Expand Down

0 comments on commit 15567fa

Please sign in to comment.