File tree Expand file tree Collapse file tree 6 files changed +237
-329
lines changed
GameEngineDevice/Source/W3DDevice/GameClient Expand file tree Collapse file tree 6 files changed +237
-329
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,12 @@ class Display : public SubsystemInterface
9696 virtual void dumpAssetUsage (const char * mapname) = 0;
9797#endif
9898
99+ // ---------------------------------------------------------------------------------------
100+ // Display scaling methods
101+ virtual Real getWidthScale ( void );
102+ virtual Real getHeightScale ( void );
103+ virtual Real getAspectRatioScale ( void );
104+
99105 // ---------------------------------------------------------------------------------------
100106 // View management
101107 virtual void attachView ( View *view ); // /< Attach the given view to the world
Original file line number Diff line number Diff line change 4343#define DEFAULT_VIEW_ORIGIN_X 0
4444#define DEFAULT_VIEW_ORIGIN_Y 0
4545
46+ #define DEFAULT_VIEW_MAX_ZOOM 1 .3f
47+ #define DEFAULT_VIEW_MIN_ZOOM 0 .2f
48+
4649// FORWARD DECLARATIONS ///////////////////////////////////////////////////////////////////////////
4750class Drawable ;
4851class ViewLocation ;
Original file line number Diff line number Diff line change @@ -202,6 +202,32 @@ void Display::setHeight( UnsignedInt height )
202202
203203}
204204
205+ // Display::getWidthScale =========================================================
206+ /* * Return the ratio of the current display width relative to the default resolution */
207+ // =============================================================================
208+ Real Display::getWidthScale (void )
209+ {
210+ return INT_TO_REAL (m_width) / DEFAULT_DISPLAY_WIDTH;
211+ }
212+
213+ // Display::getHeightScale =========================================================
214+ /* * Return the ratio of the current display height relative to the default resolution */
215+ // =============================================================================
216+ Real Display::getHeightScale (void )
217+ {
218+ return INT_TO_REAL (m_height) / DEFAULT_DISPLAY_HEIGHT;
219+ }
220+
221+ // Display::getAspectRatioScale =========================================================
222+ /* * Return the ratio of the current display aspect ratio relative to the default aspect ratio */
223+ // =============================================================================
224+ Real Display::getAspectRatioScale (void )
225+ {
226+ Real baseAspectRatio = INT_TO_REAL (DEFAULT_DISPLAY_WIDTH) / DEFAULT_DISPLAY_HEIGHT;
227+ Real currentAspectRatio = INT_TO_REAL (m_width) / m_height;
228+ return currentAspectRatio / baseAspectRatio;
229+ }
230+
205231// ============================================================================
206232// Display::playLogoMovie
207233// minMovieLength is in milliseconds
You can’t perform that action at this time.
0 commit comments