Skip to content

Commit

Permalink
Improve calculateMaxFSSize
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Dec 20, 2022
1 parent ff6a42f commit 81f6386
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/client/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2592,7 +2592,7 @@ ClientDynamicInfo Game::getCurrentDynamicInfo() const

return {
screen_size, gui_scaling, hud_scaling,
ClientDynamicInfo::calculateMaxFSSize(screen_size, gui_scaling)
ClientDynamicInfo::calculateMaxFSSize(screen_size)
};
}

Expand Down
15 changes: 12 additions & 3 deletions src/clientdynamicinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,17 @@ struct ClientDynamicInfo
abs(real_hud_scaling - other.real_hud_scaling) < 0.001f;
}

static v2f32 calculateMaxFSSize(v2u32 render_target_size, f32 real_gui_scaling) {
float slot_size = 0.5555f * 96.f * real_gui_scaling;
return v2f32(render_target_size.X, render_target_size.Y) / slot_size;
static v2f32 calculateMaxFSSize(v2u32 render_target_size) {
f32 factor =
#ifdef HAVE_TOUCHSCREENGUI
10;
#else
15;
#endif
f32 ratio = (f32)render_target_size.X / (f32)render_target_size.Y;
if (ratio < 1)
return { factor, factor / ratio };
else
return { factor * ratio, factor };
}
};

0 comments on commit 81f6386

Please sign in to comment.