Skip to content

Commit 1dd1f15

Browse files
committed
tweak(display): add new functions to return ratios of screen dimensions relative to defaults
1 parent 5de3d63 commit 1dd1f15

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
@@ -92,6 +92,11 @@ class Display : public SubsystemInterface
9292
virtual void dumpAssetUsage(const char* mapname) = 0;
9393
#endif
9494

95+
//---------------------------------------------------------------------------------------
96+
// Display scaling methods
97+
Real getWidthScale();
98+
Real getHeightScale();
99+
95100
//---------------------------------------------------------------------------------------
96101
// View management
97102
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
@@ -202,6 +202,18 @@ void Display::setHeight( UnsignedInt height )
202202

203203
}
204204

205+
// Return the ratio of the current display width relative to the default resolution
206+
Real Display::getWidthScale(void)
207+
{
208+
return (Real)m_width / DEFAULT_DISPLAY_WIDTH;
209+
}
210+
211+
// Return the ratio of the current display height relative to the default resolution
212+
Real Display::getHeightScale(void)
213+
{
214+
return (Real)m_height / DEFAULT_DISPLAY_HEIGHT;
215+
}
216+
205217
//============================================================================
206218
// Display::playLogoMovie
207219
// minMovieLength is in milliseconds

0 commit comments

Comments
 (0)