diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index b9288b5d15..a152911405 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -133,6 +133,11 @@ PrefsManager::PrefsManager() m_bVsync = true; m_sLanguage = ""; // ThemeManager will deal with this invalid language + m_iCenterImageTranslateX = 0; + m_iCenterImageTranslateY = 0; + m_fCenterImageScaleX = 1; + m_fCenterImageScaleY = 1; + /* XXX: Set these defaults for individual consoles using VideoCardDefaults.ini. */ #ifdef _XBOX @@ -288,6 +293,10 @@ void PrefsManager::ReadGlobalPrefsFromDisk() for( int p=0; pIsBeingPressed( DeviceInput(DEVICE_KEYBOARD, SDLK_RSHIFT)) || + INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, SDLK_LSHIFT)); + + int iScale; + switch( type ) { + case IET_SLOW_REPEAT: iScale = 4; break; + case IET_FAST_REPEAT: iScale = 16; break; + default: iScale = 1; break; } switch( DeviceI.button ) { case SDLK_SPACE: - if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, SDLK_RSHIFT)) || - INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, SDLK_LSHIFT)) ) - { - if( DeviceI.button == SDLK_LEFT ) - DISPLAY->CenteringScale( 0.999f, 1, 1 ); - if( DeviceI.button == SDLK_DOWN ) - DISPLAY->CenteringScale( 1.f, 1/0.999f, 1.f ); - if( DeviceI.button == SDLK_UP ) - DISPLAY->CenteringScale( 1.f, 0.999f, 1.f ); - if( DeviceI.button == SDLK_RIGHT ) - DISPLAY->CenteringScale( 1/0.999f, 1.f, 1.f ); - } - else - { - if( DeviceI.button == SDLK_LEFT ) - DISPLAY->CenteringTranslate( -1, 0, 0 ); - if( DeviceI.button == SDLK_DOWN ) - DISPLAY->CenteringTranslate( 0, +1, 0 ); - if( DeviceI.button == SDLK_UP ) - DISPLAY->CenteringTranslate( 0, -1, 0 ); - if( DeviceI.button == SDLK_RIGHT ) - DISPLAY->CenteringTranslate( +1, 0, 0 ); - } + PREFSMAN->m_iCenterImageTranslateX = 0; + PREFSMAN->m_iCenterImageTranslateY = 0; + PREFSMAN->m_fCenterImageScaleX = 1; + PREFSMAN->m_fCenterImageScaleY = 1; break; + case SDLK_LEFT: + if( bHoldingShift ) + PREFSMAN->m_fCenterImageScaleX -= 0.001f * iScale; + else + PREFSMAN->m_iCenterImageTranslateX -= 1 * iScale; + break; + case SDLK_RIGHT: + if( bHoldingShift ) + PREFSMAN->m_fCenterImageScaleX += 0.001f * iScale; + else + PREFSMAN->m_iCenterImageTranslateX += 1 * iScale; + break; + case SDLK_UP: + if( bHoldingShift ) + PREFSMAN->m_fCenterImageScaleY -= 0.001f * iScale; + else + PREFSMAN->m_iCenterImageTranslateY -= 1 * iScale; + break; + case SDLK_DOWN: + if( bHoldingShift ) + PREFSMAN->m_fCenterImageScaleY += 0.001f * iScale; + else + PREFSMAN->m_iCenterImageTranslateY += 1 * iScale; + break; + } + + switch( DeviceI.button ) + { + case SDLK_SPACE: + case SDLK_LEFT: + case SDLK_RIGHT: + case SDLK_UP: + case SDLK_DOWN: + DISPLAY->ChangeCentering( + PREFSMAN->m_iCenterImageTranslateX, + PREFSMAN->m_iCenterImageTranslateY, + PREFSMAN->m_fCenterImageScaleX, + PREFSMAN->m_fCenterImageScaleY ); + break; + } + + switch( DeviceI.button ) + { case SDLK_ESCAPE: if(!m_Menu.IsTransitioning()) { diff --git a/stepmania/src/ScreenTestInput.cpp b/stepmania/src/ScreenTestInput.cpp new file mode 100644 index 0000000000..88003a2a2b --- /dev/null +++ b/stepmania/src/ScreenTestInput.cpp @@ -0,0 +1,116 @@ +#include "global.h" +/* +----------------------------------------------------------------------------- + Class: ScreenTestInput + + Desc: Where the player maps device input to pad input. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "ScreenTestInput.h" +#include "PrefsManager.h" +#include "ScreenManager.h" +#include "GameConstantsAndTypes.h" +#include "PrefsManager.h" +#include "RageLog.h" +#include "InputMapper.h" +#include "GameManager.h" +#include "GameState.h" +#include "RageSounds.h" +#include "ThemeManager.h" +#include "RageDisplay.h" + + + +ScreenTestInput::ScreenTestInput( CString sClassName ) : Screen( sClassName ) +{ + LOG->Trace( "ScreenTestInput::ScreenTestInput()" ); + + + m_textInputs.LoadFromFont( THEME->GetPathToF("Common normal") ); + m_textInputs.SetText( "" ); + m_textInputs.SetXY( CENTER_X, CENTER_Y ); + m_textInputs.SetDiffuse( RageColor(1,1,1,1) ); + m_textInputs.SetZoom( 0.8f ); + this->AddChild( &m_textInputs ); + + m_Menu.Load( "ScreenTestInput" ); + this->AddChild( &m_Menu ); + + SOUND->PlayMusic( THEME->GetPathToS("ScreenTestInput music") ); +} + + + +ScreenTestInput::~ScreenTestInput() +{ + LOG->Trace( "ScreenTestInput::~ScreenTestInput()" ); +} + + +void ScreenTestInput::Update( float fDeltaTime ) +{ + Screen::Update( fDeltaTime ); + + CStringArray asInputs; + + DeviceInput di; + + for( int d=0; dIsBeingPressed(di) ) + { + CString sTemp; + sTemp += di.GetDescription(); + + GameInput gi; + if( INPUTMAPPER->DeviceToGame(di,gi) ) + { + CString sName = GAMESTATE->GetCurrentGameDef()->m_szButtonNames[b]; + CString sSecondary = GAMESTATE->GetCurrentGameDef()->m_szSecondaryFunction[b]; + + sTemp += "(" + sName + ", " + sSecondary + ")"; + } + + asInputs.push_back( sTemp ); + } + } + } + + m_sDeviceInputs = join( "\n ", asInputs ); +} + + +void ScreenTestInput::DrawPrimitives() +{ + m_Menu.DrawBottomLayer(); + Screen::DrawPrimitives(); + m_Menu.DrawTopLayer(); +} + +void ScreenTestInput::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) +{ + if( type != IET_FIRST_PRESS && type != IET_SLOW_REPEAT ) + return; // ignore + + Screen::Input( DeviceI, type, GameI, MenuI, StyleI ); // default handler +} + +void ScreenTestInput::HandleScreenMessage( const ScreenMessage SM ) +{ + switch( SM ) + { + case SM_GoToNextScreen: + case SM_GoToPrevScreen: + SCREENMAN->SetNewScreen( "ScreenOptionsMenu" ); + break; + } +} diff --git a/stepmania/src/ScreenTestInput.h b/stepmania/src/ScreenTestInput.h new file mode 100644 index 0000000000..0b7c5ea0e0 --- /dev/null +++ b/stepmania/src/ScreenTestInput.h @@ -0,0 +1,40 @@ +/* +----------------------------------------------------------------------------- + Class: ScreenTestInput + + Desc: Where the player maps device input to instrument buttons. + + Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved. + Chris Danford +----------------------------------------------------------------------------- +*/ + +#include "Screen.h" +#include "Sprite.h" +#include "BitmapText.h" +#include "PrefsManager.h" +#include "GrayArrow.h" +#include "InputMapper.h" +#include "MenuElements.h" +#include "RageInputDevice.h" + + +class ScreenTestInput : public Screen +{ +public: + ScreenTestInput( CString sName ); + virtual ~ScreenTestInput(); + + virtual void DrawPrimitives(); + virtual void Update( float fDelta ); + virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); + virtual void HandleScreenMessage( const ScreenMessage SM ); + +private: + CString m_sDeviceInputs; + CString m_sGameInputs; + BitmapText m_textInputs; + + MenuElements m_Menu; +}; + diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index df0b0098f5..53a850e0e0 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -165,6 +165,12 @@ void ApplyGraphicOptions() bNeedReload |= DISPLAY->SetVideoMode( GetCurVideoModeParams() ); + DISPLAY->ChangeCentering( + PREFSMAN->m_iCenterImageTranslateX, + PREFSMAN->m_iCenterImageTranslateY, + PREFSMAN->m_fCenterImageScaleX, + PREFSMAN->m_fCenterImageScaleY ); + bNeedReload |= TEXTUREMAN->SetPrefs( PREFSMAN->m_iTextureColorDepth, PREFSMAN->m_iMovieColorDepth, @@ -802,6 +808,13 @@ int main(int argc, char* argv[]) delete loading_window; // destroy this before init'ing Display DISPLAY = CreateDisplay(); + + DISPLAY->ChangeCentering( + PREFSMAN->m_iCenterImageTranslateX, + PREFSMAN->m_iCenterImageTranslateY, + PREFSMAN->m_fCenterImageScaleX, + PREFSMAN->m_fCenterImageScaleY ); + TEXTUREMAN = new RageTextureManager(); TEXTUREMAN->SetPrefs( PREFSMAN->m_iTextureColorDepth,