From af1412c3d8506462a3015e490d76f079cda03ad3 Mon Sep 17 00:00:00 2001 From: Josh Allen Date: Wed, 6 Sep 2006 19:06:41 +0000 Subject: [PATCH] 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. --- stepmania/src/ScreenDimensions.cpp | 3 ++- stepmania/src/ScreenDimensions.h | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/stepmania/src/ScreenDimensions.cpp b/stepmania/src/ScreenDimensions.cpp index a4219c6c4a..feebdcc035 100644 --- a/stepmania/src/ScreenDimensions.cpp +++ b/stepmania/src/ScreenDimensions.cpp @@ -23,7 +23,6 @@ static ThemeMetric 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 ); diff --git a/stepmania/src/ScreenDimensions.h b/stepmania/src/ScreenDimensions.h index fb093ea7ae..7ecf0db62f 100644 --- a/stepmania/src/ScreenDimensions.h +++ b/stepmania/src/ScreenDimensions.h @@ -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)