From d8b681dfd50b9db36210596c21748000046eb7bd Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Mon, 13 Oct 2003 08:32:31 +0000 Subject: [PATCH] add missing file --- stepmania/src/ScreenAdjustCentering.cpp | 103 ++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 stepmania/src/ScreenAdjustCentering.cpp diff --git a/stepmania/src/ScreenAdjustCentering.cpp b/stepmania/src/ScreenAdjustCentering.cpp new file mode 100644 index 0000000000..6a19a65eb6 --- /dev/null +++ b/stepmania/src/ScreenAdjustCentering.cpp @@ -0,0 +1,103 @@ +#include "global.h" +/* +----------------------------------------------------------------------------- + Class: ScreenCenterImage + + 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 "ScreenCenterImage.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" + + + + +ScreenCenterImage::ScreenCenterImage( CString sClassName ) : Screen( sClassName ) +{ + LOG->Trace( "ScreenCenterImage::ScreenCenterImage()" ); + + m_textInstructions.LoadFromFont( THEME->GetPathToF("Common normal") ); + m_textInstructions.SetText( "" ); + m_textInstructions.SetXY( CENTER_X, CENTER_Y ); + m_textInstructions.SetDiffuse( RageColor(0,1,0,0) ); + m_textInstructions.SetZoom( 0.8f ); + this->AddChild( &m_textInstructions ); + + m_Menu.Load( "ScreenCenterImage" ); + this->AddChild( &m_Menu ); + + SOUND->PlayMusic( THEME->GetPathToS("ScreenCenterImage music") ); +} + + + +ScreenCenterImage::~ScreenCenterImage() +{ + LOG->Trace( "ScreenCenterImage::~ScreenCenterImage()" ); +} + + + +void ScreenCenterImage::DrawPrimitives() +{ + m_Menu.DrawBottomLayer(); + Screen::DrawPrimitives(); + m_Menu.DrawTopLayer(); +} + +void ScreenCenterImage::Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) +{ + if( m_Menu.IsTransitioning() ) + return; + + if( type != IET_RELEASE ) + { + if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, SDLK_RSHIFT)) || + INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, SDLK_LSHIFT)) ) + { + if( DeviceI.button == SDLK_LEFT ) + DISPLAY->CenteringScale( 0.99, 0, 0 ); + if( DeviceI.button == SDLK_DOWN ) + DISPLAY->CenteringScale( 0, 1/0.99, 0 ); + if( DeviceI.button == SDLK_UP ) + DISPLAY->CenteringScale( 0, 0.99, 0 ); + if( DeviceI.button == SDLK_RIGHT ) + DISPLAY->CenteringScale( 1/0.99, 0, 0 ); + } + 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 ); + } + } +} + +void ScreenCenterImage::HandleScreenMessage( const ScreenMessage SM ) +{ + switch( SM ) + { + case SM_GoToNextScreen: + SCREENMAN->SetNewScreen( "ScreenOptionsMenu" ); + break; + } +}