give up on auto AR. Handling the AR when the resolution is falling back is more complicated than it's worth.
This commit is contained in:
@@ -154,6 +154,7 @@ PrefsManager::PrefsManager() :
|
||||
m_bWindowed ( "Windowed", TRUE_IF_DEBUG ),
|
||||
m_iDisplayWidth ( "DisplayWidth", 640 ),
|
||||
m_iDisplayHeight ( "DisplayHeight", 480 ),
|
||||
m_fDisplayAspectRatio ( "DisplayAspectRatio", 4/3.f ),
|
||||
m_iDisplayColorDepth ( "DisplayColorDepth", 16 ),
|
||||
m_iTextureColorDepth ( "TextureColorDepth", 16 ),
|
||||
m_iMovieColorDepth ( "MovieColorDepth", 16 ),
|
||||
@@ -430,6 +431,8 @@ void PrefsManager::ReadPrefsFromIni( const IniFile &ini, const RString &sSection
|
||||
IPreference::ReadAllPrefsFromNode( ini.GetChild(sSection) );
|
||||
|
||||
// validate
|
||||
if( m_fDisplayAspectRatio < 0 )
|
||||
m_fDisplayAspectRatio.Set( 4/3.f );
|
||||
m_iSongsPerPlay.Set( clamp(m_iSongsPerPlay.Get(),0,MAX_SONGS_PER_PLAY) );
|
||||
m_RandomBackgroundMode.Set( (RandomBackgroundMode)clamp((int)m_RandomBackgroundMode.Get(),0,(int)NUM_RandomBackgroundMode-1) );
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ public:
|
||||
Preference<bool> m_bWindowed;
|
||||
Preference<int> m_iDisplayWidth;
|
||||
Preference<int> m_iDisplayHeight;
|
||||
Preference<float> m_fDisplayAspectRatio;
|
||||
Preference<int> m_iDisplayColorDepth;
|
||||
Preference<int> m_iTextureColorDepth;
|
||||
Preference<int> m_iMovieColorDepth;
|
||||
|
||||
@@ -27,24 +27,6 @@ static ThemeMetric<float> THEME_SCREEN_HEIGHT("Common","ScreenHeight");
|
||||
*/
|
||||
#define THEME_NATIVE_ASPECT (THEME_SCREEN_WIDTH/THEME_SCREEN_HEIGHT)
|
||||
|
||||
#define ASPECT_AUTO -1
|
||||
static Preference<float> g_fDisplayAspectRatio( "DisplayAspectRatio", ASPECT_AUTO );
|
||||
|
||||
float ScreenDimensions::GetScreenAspectRatio()
|
||||
{
|
||||
float fAspect = g_fDisplayAspectRatio;
|
||||
if( fAspect == ASPECT_AUTO )
|
||||
{
|
||||
// Lua values will be reloaded after the display is created, so any value we
|
||||
// return before DISPLAY is created will never be used.
|
||||
if( DISPLAY )
|
||||
fAspect = DISPLAY->GetMonitorAspectRatio();
|
||||
else
|
||||
fAspect = 4/3.f;
|
||||
}
|
||||
return fAspect;
|
||||
}
|
||||
|
||||
float ScreenDimensions::GetThemeAspectRatio()
|
||||
{
|
||||
return THEME_NATIVE_ASPECT;
|
||||
@@ -52,7 +34,7 @@ float ScreenDimensions::GetThemeAspectRatio()
|
||||
|
||||
float ScreenDimensions::GetScreenWidth()
|
||||
{
|
||||
float fAspect = GetScreenAspectRatio();
|
||||
float fAspect = PREFSMAN->m_fDisplayAspectRatio;
|
||||
float fScale = 1;
|
||||
if( fAspect > THEME_NATIVE_ASPECT )
|
||||
fScale = fAspect / THEME_NATIVE_ASPECT;
|
||||
@@ -62,7 +44,7 @@ float ScreenDimensions::GetScreenWidth()
|
||||
|
||||
float ScreenDimensions::GetScreenHeight()
|
||||
{
|
||||
float fAspect = GetScreenAspectRatio();
|
||||
float fAspect = PREFSMAN->m_fDisplayAspectRatio;
|
||||
float fScale = 1;
|
||||
if( fAspect < THEME_NATIVE_ASPECT )
|
||||
fScale = THEME_NATIVE_ASPECT / fAspect;
|
||||
@@ -86,7 +68,7 @@ void ScreenDimensions::ReloadScreenDimensions()
|
||||
LUA->SetGlobal( "SCREEN_CENTER_Y", (int) SCREEN_CENTER_Y );
|
||||
}
|
||||
|
||||
LuaFunction_NoArgs( GetScreenAspectRatio, ScreenDimensions::GetScreenAspectRatio() );
|
||||
LuaFunction_NoArgs( GetScreenAspectRatio, PREFSMAN->m_fDisplayAspectRatio );
|
||||
LuaFunction_NoArgs( GetThemeAspectRatio, ScreenDimensions::GetThemeAspectRatio() );
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
namespace ScreenDimensions
|
||||
{
|
||||
float GetScreenAspectRatio();
|
||||
float GetThemeAspectRatio();
|
||||
float GetScreenWidth();
|
||||
float GetScreenHeight();
|
||||
@@ -15,17 +14,17 @@ namespace ScreenDimensions
|
||||
#define SCREEN_WIDTH ScreenDimensions::GetScreenWidth()
|
||||
#define SCREEN_HEIGHT ScreenDimensions::GetScreenHeight()
|
||||
|
||||
#define SCREEN_LEFT (0)
|
||||
#define SCREEN_RIGHT (SCREEN_WIDTH)
|
||||
#define SCREEN_TOP (0)
|
||||
#define SCREEN_BOTTOM (SCREEN_HEIGHT)
|
||||
#define SCREEN_LEFT (0)
|
||||
#define SCREEN_RIGHT (SCREEN_WIDTH)
|
||||
#define SCREEN_TOP (0)
|
||||
#define SCREEN_BOTTOM (SCREEN_HEIGHT)
|
||||
|
||||
#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 SCREEN_CENTER_X (SCREEN_LEFT + (SCREEN_RIGHT - SCREEN_LEFT)/2.0f)
|
||||
#define SCREEN_CENTER_Y (SCREEN_TOP + (SCREEN_BOTTOM - SCREEN_TOP)/2.0f)
|
||||
|
||||
#define FullScreenRectF RectF(SCREEN_LEFT,SCREEN_TOP,SCREEN_RIGHT,SCREEN_BOTTOM)
|
||||
|
||||
#define ARROW_SIZE (64)
|
||||
#define ARROW_SIZE (64)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -506,7 +506,7 @@ static void RefreshRate( int &sel, bool ToSel, const ConfOption *pConfOption )
|
||||
|
||||
static void DisplayAspectRatio( int &sel, bool ToSel, const ConfOption *pConfOption )
|
||||
{
|
||||
const float mapping[] = { -1,3/4.f,1,4/3.0f,16/10.0f,16/9.f, 8/3.f };
|
||||
const float mapping[] = { 3/4.f,1,4/3.0f,16/10.0f,16/9.f, 8/3.f };
|
||||
MoveMap( sel, pConfOption, ToSel, mapping, ARRAYSIZE(mapping) );
|
||||
}
|
||||
|
||||
@@ -614,7 +614,7 @@ static void InitializeConfOptions()
|
||||
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
|
||||
ADD( ConfOption( "DisplayResolution", DisplayResolutionM, DisplayResolutionChoices ) );
|
||||
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS | OPT_APPLY_ASPECT_RATIO;
|
||||
ADD( ConfOption( "DisplayAspectRatio", DisplayAspectRatio, "Auto","|3:4","|1:1","|4:3","|16:10","|16:9","|8:3" ) );
|
||||
ADD( ConfOption( "DisplayAspectRatio", DisplayAspectRatio, "|3:4","|1:1","|4:3","|16:10","|16:9","|8:3" ) );
|
||||
g_ConfOptions.back().m_iEffects = OPT_APPLY_ASPECT_RATIO;
|
||||
ADD( ConfOption( "DisplayColorDepth", DisplayColorDepth, "16bit","32bit" ) );
|
||||
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
|
||||
|
||||
@@ -102,7 +102,7 @@ void StepMania::GetPreferredVideoModeParams( VideoModeParams ¶msOut )
|
||||
CommonMetrics::WINDOW_TITLE,
|
||||
THEME->GetPathG("Common","window icon"),
|
||||
PREFSMAN->m_bPAL,
|
||||
ScreenDimensions::GetScreenAspectRatio()
|
||||
PREFSMAN->m_fDisplayAspectRatio
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user