Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions GeneralsMD/Code/GameEngine/Include/GameClient/Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ class Display : public SubsystemInterface
virtual void dumpAssetUsage(const char* mapname) = 0;
#endif

//---------------------------------------------------------------------------------------
// Display scaling methods
virtual Real getWidthScale( void );
virtual Real getHeightScale( void );
virtual Real getAspectRatioScale( void );

//---------------------------------------------------------------------------------------
// View management
virtual void attachView( View *view ); ///< Attach the given view to the world
Expand Down
3 changes: 3 additions & 0 deletions GeneralsMD/Code/GameEngine/Include/GameClient/View.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
#define DEFAULT_VIEW_ORIGIN_X 0
#define DEFAULT_VIEW_ORIGIN_Y 0

#define DEFAULT_VIEW_MAX_ZOOM 1.3f
#define DEFAULT_VIEW_MIN_ZOOM 0.2f

// FORWARD DECLARATIONS ///////////////////////////////////////////////////////////////////////////
class Drawable;
class ViewLocation;
Expand Down
26 changes: 26 additions & 0 deletions GeneralsMD/Code/GameEngine/Source/GameClient/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,32 @@ void Display::setHeight( UnsignedInt height )

}

// Display::getWidthScale =========================================================
/** Return the ratio of the current display width relative to the default resolution */
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not use /* for comments. It screws with syntax highlighting in diff tools (when spanning multiple lines).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replicating the style of the original code that is currently in place.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are // just below the new function.

//=============================================================================
Real Display::getWidthScale(void)
{
return INT_TO_REAL(m_width) / DEFAULT_DISPLAY_WIDTH;
}

// Display::getHeightScale =========================================================
/** Return the ratio of the current display height relative to the default resolution */
//=============================================================================
Real Display::getHeightScale(void)
{
return INT_TO_REAL(m_height) / DEFAULT_DISPLAY_HEIGHT;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can just use (Real)m_height?

}

// Display::getAspectRatioScale =========================================================
/** Return the ratio of the current display aspect ratio relative to the default aspect ratio */
//=============================================================================
Real Display::getAspectRatioScale(void)
{
Real baseAspectRatio = INT_TO_REAL(DEFAULT_DISPLAY_WIDTH) / DEFAULT_DISPLAY_HEIGHT;
Real currentAspectRatio = INT_TO_REAL(m_width) / m_height;
return currentAspectRatio / baseAspectRatio;
}

//============================================================================
// Display::playLogoMovie
// minMovieLength is in milliseconds
Expand Down
Loading
Loading