add aspect ratio pref
This commit is contained in:
@@ -2976,7 +2976,7 @@ Line6=conf,RandomBackgrounds
|
|||||||
|
|
||||||
[ScreenAppearanceOptions]
|
[ScreenAppearanceOptions]
|
||||||
Fallback=ScreenOptionsSubmenu
|
Fallback=ScreenOptionsSubmenu
|
||||||
LineNames=1,2,3,4,5,6,7,8,9,10,11,12,13
|
LineNames=1,2,3,4,5,6,7,8,9,10,11,12,13,14
|
||||||
OptionMenuFlags=together;explanations
|
OptionMenuFlags=together;explanations
|
||||||
Line1=conf,Language
|
Line1=conf,Language
|
||||||
Line2=conf,Announcer
|
Line2=conf,Announcer
|
||||||
@@ -2991,6 +2991,7 @@ Line10=conf,CourseSort
|
|||||||
Line11=conf,RandomAtEnd
|
Line11=conf,RandomAtEnd
|
||||||
Line12=conf,Translations
|
Line12=conf,Translations
|
||||||
Line13=conf,Lyrics
|
Line13=conf,Lyrics
|
||||||
|
Line14=conf,AspectRatio
|
||||||
|
|
||||||
[ScreenOtherOptions]
|
[ScreenOtherOptions]
|
||||||
Fallback=ScreenOptionsSubmenu
|
Fallback=ScreenOptionsSubmenu
|
||||||
|
|||||||
@@ -153,8 +153,8 @@ void Lua::UpdateGlobals()
|
|||||||
ASSERT( L );
|
ASSERT( L );
|
||||||
|
|
||||||
/* Important: explicitly refresh cached metrics that we use. */
|
/* Important: explicitly refresh cached metrics that we use. */
|
||||||
SCREEN_WIDTH.Read();
|
THEME_SCREEN_WIDTH.Read();
|
||||||
SCREEN_HEIGHT.Read();
|
THEME_SCREEN_HEIGHT.Read();
|
||||||
|
|
||||||
lua_pushnumber( L, SCREEN_WIDTH );
|
lua_pushnumber( L, SCREEN_WIDTH );
|
||||||
lua_setglobal( L, "SCREEN_WIDTH" );
|
lua_setglobal( L, "SCREEN_WIDTH" );
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ PrefsManager::PrefsManager() :
|
|||||||
m_iMovieColorDepth ( Options, "MovieColorDepth", 16 ),
|
m_iMovieColorDepth ( Options, "MovieColorDepth", 16 ),
|
||||||
m_iMaxTextureResolution ( Options, "MaxTextureResolution", 2048 ),
|
m_iMaxTextureResolution ( Options, "MaxTextureResolution", 2048 ),
|
||||||
m_iRefreshRate ( Options, "RefreshRate", REFRESH_DEFAULT ),
|
m_iRefreshRate ( Options, "RefreshRate", REFRESH_DEFAULT ),
|
||||||
|
m_fAspectRatio ( Options, "AspectRatio", 4/3.0f ),
|
||||||
m_bShowStats ( Options, "ShowStats",
|
m_bShowStats ( Options, "ShowStats",
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
true
|
true
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public:
|
|||||||
Preference<int> m_iMovieColorDepth;
|
Preference<int> m_iMovieColorDepth;
|
||||||
Preference<int> m_iMaxTextureResolution;
|
Preference<int> m_iMaxTextureResolution;
|
||||||
Preference<int> m_iRefreshRate;
|
Preference<int> m_iRefreshRate;
|
||||||
|
Preference<float> m_fAspectRatio;
|
||||||
Preference<bool> m_bShowStats;
|
Preference<bool> m_bShowStats;
|
||||||
Preference<bool> m_bShowBanners;
|
Preference<bool> m_bShowBanners;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,37 @@
|
|||||||
#include "global.h"
|
#include "global.h"
|
||||||
#include "ScreenDimensions.h"
|
#include "ScreenDimensions.h"
|
||||||
|
#include "PrefsManager.h"
|
||||||
|
|
||||||
|
|
||||||
|
ThemeMetric<float> THEME_SCREEN_WIDTH("Common","ScreenWidth");
|
||||||
|
ThemeMetric<float> THEME_SCREEN_HEIGHT("Common","ScreenHeight");
|
||||||
|
|
||||||
|
//
|
||||||
|
// The theme's logical resolution specifies the minimum screen width
|
||||||
|
// and the minimum screen height with a 4:3 aspect ratio. Scale just one
|
||||||
|
// of the dimensions up to meet the requested aspect ratio.
|
||||||
|
//
|
||||||
|
|
||||||
|
#define ASPECT_4_TO_3 (4/3.0f)
|
||||||
|
|
||||||
|
float ScreenWidth()
|
||||||
|
{
|
||||||
|
float fScale = 1;
|
||||||
|
if( PREFSMAN->m_fAspectRatio > ASPECT_4_TO_3 )
|
||||||
|
fScale = PREFSMAN->m_fAspectRatio / ASPECT_4_TO_3;
|
||||||
|
ASSERT( fScale >= 1 );
|
||||||
|
return THEME_SCREEN_WIDTH * fScale;
|
||||||
|
}
|
||||||
|
|
||||||
|
float ScreenHeight()
|
||||||
|
{
|
||||||
|
float fScale = 1;
|
||||||
|
if( PREFSMAN->m_fAspectRatio < ASPECT_4_TO_3 )
|
||||||
|
fScale = ASPECT_4_TO_3 / PREFSMAN->m_fAspectRatio;
|
||||||
|
ASSERT( fScale >= 1 );
|
||||||
|
return THEME_SCREEN_HEIGHT * fScale;
|
||||||
|
}
|
||||||
|
|
||||||
ThemeMetric<float> SCREEN_WIDTH("Common","ScreenWidth");
|
|
||||||
ThemeMetric<float> SCREEN_HEIGHT("Common","ScreenHeight");
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (c) 2001-2002 Chris Danford
|
* (c) 2001-2002 Chris Danford
|
||||||
|
|||||||
@@ -6,8 +6,13 @@
|
|||||||
#include "ThemeManager.h"
|
#include "ThemeManager.h"
|
||||||
#include "ThemeMetric.h"
|
#include "ThemeMetric.h"
|
||||||
|
|
||||||
extern ThemeMetric<float> SCREEN_WIDTH;
|
#define SCREEN_WIDTH ScreenWidth()
|
||||||
extern ThemeMetric<float> SCREEN_HEIGHT;
|
#define SCREEN_HEIGHT ScreenHeight()
|
||||||
|
float ScreenWidth();
|
||||||
|
float ScreenHeight();
|
||||||
|
|
||||||
|
extern ThemeMetric<float> THEME_SCREEN_WIDTH;
|
||||||
|
extern ThemeMetric<float> THEME_SCREEN_HEIGHT;
|
||||||
|
|
||||||
#define SCREEN_LEFT (0)
|
#define SCREEN_LEFT (0)
|
||||||
#define SCREEN_RIGHT (SCREEN_WIDTH)
|
#define SCREEN_RIGHT (SCREEN_WIDTH)
|
||||||
|
|||||||
@@ -95,6 +95,9 @@ void ScreenManager::ThemeChanged()
|
|||||||
SAFE_DELETE( m_SystemLayer );
|
SAFE_DELETE( m_SystemLayer );
|
||||||
m_SystemLayer = new ScreenSystemLayer;
|
m_SystemLayer = new ScreenSystemLayer;
|
||||||
m_SystemLayer->RefreshCreditsMessages();
|
m_SystemLayer->RefreshCreditsMessages();
|
||||||
|
|
||||||
|
// reload shared BGA
|
||||||
|
m_pSharedBGA->LoadFromAniDir( m_sLastLoadedBackgroundPath );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenManager::EmptyDeleteQueue()
|
void ScreenManager::EmptyDeleteQueue()
|
||||||
@@ -361,9 +364,9 @@ retry:
|
|||||||
if( sNewBGA.empty() )
|
if( sNewBGA.empty() )
|
||||||
{
|
{
|
||||||
m_pSharedBGA->Unload();
|
m_pSharedBGA->Unload();
|
||||||
m_sLastLoadedBackground = "";
|
m_sLastLoadedBackgroundPath = "";
|
||||||
}
|
}
|
||||||
else if( m_sLastLoadedBackground != sNewBGA )
|
else if( m_sLastLoadedBackgroundPath != sNewBGA )
|
||||||
{
|
{
|
||||||
// Create the new background before deleting the previous so that we keep
|
// Create the new background before deleting the previous so that we keep
|
||||||
// any common textures loaded.
|
// any common textures loaded.
|
||||||
@@ -372,7 +375,7 @@ retry:
|
|||||||
SAFE_DELETE( m_pSharedBGA );
|
SAFE_DELETE( m_pSharedBGA );
|
||||||
m_pSharedBGA = pNewBGA;
|
m_pSharedBGA = pNewBGA;
|
||||||
|
|
||||||
m_sLastLoadedBackground = sNewBGA;
|
m_sLastLoadedBackgroundPath = sNewBGA;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool bWasOnSystemMenu = GAMESTATE->m_bIsOnSystemMenu;
|
bool bWasOnSystemMenu = GAMESTATE->m_bIsOnSystemMenu;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ private:
|
|||||||
vector<Screen*> m_ScreenStack; // bottommost to topmost
|
vector<Screen*> m_ScreenStack; // bottommost to topmost
|
||||||
ScreenSystemLayer *m_SystemLayer;
|
ScreenSystemLayer *m_SystemLayer;
|
||||||
|
|
||||||
CString m_sLastLoadedBackground;
|
CString m_sLastLoadedBackgroundPath;
|
||||||
CString m_sDelayedScreen;
|
CString m_sDelayedScreen;
|
||||||
ScreenMessage m_MessageSendOnPop;
|
ScreenMessage m_MessageSendOnPop;
|
||||||
vector<Screen*> m_vPreparedScreens;
|
vector<Screen*> m_vPreparedScreens;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
#include "RageSoundManager.h"
|
#include "RageSoundManager.h"
|
||||||
#include "ProfileManager.h"
|
#include "ProfileManager.h"
|
||||||
#include "StepsUtil.h"
|
#include "StepsUtil.h"
|
||||||
|
#include "LuaHelpers.h"
|
||||||
|
|
||||||
#define LINE_NAMES THEME->GetMetric (m_sName,"LineNames")
|
#define LINE_NAMES THEME->GetMetric (m_sName,"LineNames")
|
||||||
#define OPTION_MENU_FLAGS THEME->GetMetric (m_sName,"OptionMenuFlags")
|
#define OPTION_MENU_FLAGS THEME->GetMetric (m_sName,"OptionMenuFlags")
|
||||||
@@ -535,9 +536,19 @@ void ScreenOptionsMaster::ExportOptions()
|
|||||||
if( m_sNextScreen == "" )
|
if( m_sNextScreen == "" )
|
||||||
m_sNextScreen = NEXT_SCREEN;
|
m_sNextScreen = NEXT_SCREEN;
|
||||||
|
|
||||||
/* Did the theme change? */
|
if( ChangeMask & OPT_APPLY_ASPECT_RATIO )
|
||||||
|
{
|
||||||
|
Lua::UpdateGlobals(); // This needs to be done before resetting the projection matrix below
|
||||||
|
SCREENMAN->ThemeChanged(); // recreate ScreenSystemLayer and SharedBGA
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If the theme changes, we need to reset RageDisplay to apply new theme
|
||||||
|
* window title and icon. */
|
||||||
|
/* If the aspect ratio changes, we need to reset RageDisplay so that the
|
||||||
|
* projection matrix is re-created using the new screen dimensions. */
|
||||||
if( (ChangeMask & OPT_APPLY_THEME) ||
|
if( (ChangeMask & OPT_APPLY_THEME) ||
|
||||||
(ChangeMask & OPT_APPLY_GRAPHICS) ) // reset graphics to apply new window title and icon
|
(ChangeMask & OPT_APPLY_GRAPHICS) ||
|
||||||
|
(ChangeMask & OPT_APPLY_ASPECT_RATIO) )
|
||||||
ApplyGraphicOptions();
|
ApplyGraphicOptions();
|
||||||
|
|
||||||
if( ChangeMask & OPT_SAVE_PREFERENCES )
|
if( ChangeMask & OPT_SAVE_PREFERENCES )
|
||||||
|
|||||||
@@ -440,6 +440,12 @@ static void RefreshRate( int &sel, bool ToSel, const ConfOption *pConfOption )
|
|||||||
MoveMap( sel, PREFSMAN->m_iRefreshRate.Value(), ToSel, mapping, ARRAYSIZE(mapping) );
|
MoveMap( sel, PREFSMAN->m_iRefreshRate.Value(), ToSel, mapping, ARRAYSIZE(mapping) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void AspectRatio( int &sel, bool ToSel, const ConfOption *pConfOption )
|
||||||
|
{
|
||||||
|
const float mapping[] = { 3/4.f,1,4/3.0f,16/10.0f,16/9.f, 8/3.f };
|
||||||
|
MoveMap( sel, PREFSMAN->m_fAspectRatio.Value(), ToSel, mapping, ARRAYSIZE(mapping) );
|
||||||
|
}
|
||||||
|
|
||||||
/* Sound options */
|
/* Sound options */
|
||||||
MOVE( ResamplingQuality, PREFSMAN->m_iSoundResampleQuality );
|
MOVE( ResamplingQuality, PREFSMAN->m_iSoundResampleQuality );
|
||||||
MOVE( AttractSoundFrequency,PREFSMAN->m_iAttractSoundFrequency );
|
MOVE( AttractSoundFrequency,PREFSMAN->m_iAttractSoundFrequency );
|
||||||
@@ -546,11 +552,13 @@ static void InitializeConfOptions()
|
|||||||
ADD( ConfOption( "DelayedTextureDelete", MovePref, "OFF","ON" ) );
|
ADD( ConfOption( "DelayedTextureDelete", MovePref, "OFF","ON" ) );
|
||||||
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
|
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
|
||||||
ADD( ConfOption( "CelShade\nModels", CelShadeModels, "OFF","ON" ) );
|
ADD( ConfOption( "CelShade\nModels", CelShadeModels, "OFF","ON" ) );
|
||||||
ADD( ConfOption( "SmoothLines", SmoothLines, "OFF","ON" ) );
|
ADD( ConfOption( "Smooth\nLines", SmoothLines, "OFF","ON" ) );
|
||||||
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
|
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
|
||||||
ADD( ConfOption( "Refresh\nRate", RefreshRate, "DEFAULT","60","70","72","75","80","85","90","100","120","150" ) );
|
ADD( ConfOption( "Refresh\nRate", RefreshRate, "DEFAULT","60","70","72","75","80","85","90","100","120","150" ) );
|
||||||
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
|
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
|
||||||
ADD( ConfOption( "Vsync", MovePref, "NO", "YES" ) );
|
ADD( ConfOption( "Aspect\nRatio", AspectRatio, "3:4","1:1","4:3","16:10","16:9","8:3" ) );
|
||||||
|
g_ConfOptions.back().m_iEffects = OPT_APPLY_ASPECT_RATIO;
|
||||||
|
ADD( ConfOption( "Vsync", MovePref, "NO", "YES" ) );
|
||||||
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
|
g_ConfOptions.back().m_iEffects = OPT_APPLY_GRAPHICS;
|
||||||
ADD( ConfOption( "ShowStats", MovePref, "OFF","ON" ) );
|
ADD( ConfOption( "ShowStats", MovePref, "OFF","ON" ) );
|
||||||
ADD( ConfOption( "ShowBanners", MovePref, "OFF","ON" ) );
|
ADD( ConfOption( "ShowBanners", MovePref, "OFF","ON" ) );
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ static const int MAX_OPTIONS=16;
|
|||||||
#define OPT_RESET_GAME (1<<3)
|
#define OPT_RESET_GAME (1<<3)
|
||||||
#define OPT_APPLY_SOUND (1<<4)
|
#define OPT_APPLY_SOUND (1<<4)
|
||||||
#define OPT_APPLY_SONG (1<<5)
|
#define OPT_APPLY_SONG (1<<5)
|
||||||
|
#define OPT_APPLY_ASPECT_RATIO (1<<6)
|
||||||
|
|
||||||
struct ConfOption
|
struct ConfOption
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user