Ability to get the scale factor between the theme's aspect ratio and screen's aspect ratio. Useful for placing actors in the same screen location regardless of aspect ratio.

This commit is contained in:
Josh Allen
2006-09-06 19:06:41 +00:00
parent 143c693a87
commit af1412c3d8
2 changed files with 5 additions and 1 deletions
+2 -1
View File
@@ -23,7 +23,6 @@ static ThemeMetric<float> THEME_SCREEN_HEIGHT("Common","ScreenHeight");
* aspect ratio of the physical display); we don't care about the PAR (pixel
* aspect ratio: the aspect ratio of a pixel).
*/
#define THEME_NATIVE_ASPECT (THEME_SCREEN_WIDTH/THEME_SCREEN_HEIGHT)
float ScreenDimensions::GetThemeAspectRatio()
{
@@ -64,6 +63,8 @@ void ScreenDimensions::ReloadScreenDimensions()
LUA->SetGlobal( "SCREEN_BOTTOM", (int) SCREEN_BOTTOM );
LUA->SetGlobal( "SCREEN_CENTER_X", (int) SCREEN_CENTER_X );
LUA->SetGlobal( "SCREEN_CENTER_Y", (int) SCREEN_CENTER_Y );
LUA->SetGlobal( "ASPECT_SCALE_FACTOR", (int) ASPECT_SCALE_FACTOR );
}
LuaFunction( GetScreenAspectRatio, PREFSMAN->m_fDisplayAspectRatio );
+3
View File
@@ -22,6 +22,9 @@ namespace ScreenDimensions
#define SCREEN_CENTER_X (SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT)/2.0f)
#define SCREEN_CENTER_Y (SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP)/2.0f)
#define THEME_NATIVE_ASPECT (THEME_SCREEN_WIDTH/THEME_SCREEN_HEIGHT)
#define ASPECT_SCALE_FACTOR ((SCREEN_WIDTH/SCREEN_HEIGHT)/THEME_NATIVE_ASPECT)
#define FullScreenRectF RectF(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM)
#define ARROW_SIZE (64)