Skip to content

Commit 45b687a

Browse files
committed
tweak(display): add new functions to return ratios of screen dimensions relative to defaults
1 parent 0c993a9 commit 45b687a

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

GeneralsMD/Code/GameEngine/Include/GameClient/Display.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ class Display : public SubsystemInterface
9090
virtual void dumpAssetUsage(const char* mapname) = 0;
9191
#endif
9292

93+
//---------------------------------------------------------------------------------------
94+
// Display scaling methods
95+
Real getWidthScale();
96+
Real getHeightScale();
97+
9398
//---------------------------------------------------------------------------------------
9499
// View management
95100
virtual void attachView( View *view ); ///< Attach the given view to the world

GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,18 @@ void Display::setHeight( UnsignedInt height )
199199

200200
}
201201

202+
// Return the ratio of the current display width relative to the default resolution
203+
Real Display::getWidthScale(void)
204+
{
205+
return (Real)m_width / DEFAULT_DISPLAY_WIDTH;
206+
}
207+
208+
// Return the ratio of the current display height relative to the default resolution
209+
Real Display::getHeightScale(void)
210+
{
211+
return (Real)m_height / DEFAULT_DISPLAY_HEIGHT;
212+
}
213+
202214
//============================================================================
203215
// Display::playLogoMovie
204216
// minMovieLength is in milliseconds

0 commit comments

Comments
 (0)