MCPcopy Create free account
hub / github.com/Panzerschrek/Chasm-Reverse / CalculateMenuScale

Function CalculateMenuScale

PanzerChasm/menu_drawers_common.cpp:10–22  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8{
9
10unsigned int CalculateMenuScale( const Size2& viewport_size )
11{
12 float scale_f=
13 std::min(
14 float( viewport_size.Width () ) / float( GameConstants::min_screen_width ),
15 float( viewport_size.Height() ) / float( GameConstants::min_screen_height ) );
16
17 // Do not scale menu too height.
18 if( scale_f > 3.0f )
19 scale_f*= 1.0f - 0.25f * std::min( scale_f - 3.0f, 1.0f );
20
21 return std::max( 1u, static_cast<unsigned int>( scale_f ) );
22}
23
24unsigned int CalculateConsoleScale( const Size2& viewport_size )
25{

Callers 2

MenuDrawerSoftMethod · 0.85
MenuDrawerGLMethod · 0.85

Calls 2

WidthMethod · 0.80
HeightMethod · 0.80

Tested by

no test coverage detected