Files
itgmania212121/stepmania/src/ScreenTestLights.cpp
T

168 lines
4.3 KiB
C++
Raw Normal View History

2004-03-23 06:33:01 +00:00
#include "global.h"
#include "ScreenTestLights.h"
#include "ScreenManager.h"
#include "GameConstantsAndTypes.h"
#include "RageLog.h"
#include "GameState.h"
#include "ThemeManager.h"
#include "LightsManager.h"
2004-07-25 17:07:32 +00:00
#include "Game.h"
#include "ScreenDimensions.h"
#include "InputEventPlus.h"
2004-03-23 06:33:01 +00:00
2004-11-26 17:28:47 +00:00
REGISTER_SCREEN_CLASS( ScreenTestLights );
ScreenTestLights::ScreenTestLights( CString sClassName ) : ScreenWithMenuElements( sClassName )
2004-03-23 06:33:01 +00:00
{
LOG->Trace( "ScreenTestLights::ScreenTestLights()" );
2005-04-21 19:54:11 +00:00
LIGHTSMAN->SetLightsMode( LIGHTSMODE_TEST_AUTO_CYCLE );
}
void ScreenTestLights::Init()
{
ScreenWithMenuElements::Init();
2004-03-23 06:33:01 +00:00
2005-05-09 03:42:18 +00:00
m_textInputs.SetName( "Text" );
2005-02-06 03:32:53 +00:00
m_textInputs.LoadFromFont( THEME->GetPathF("Common","normal") );
2004-03-23 06:33:01 +00:00
m_textInputs.SetText( "" );
2005-05-09 03:42:18 +00:00
SET_XY_AND_ON_COMMAND( m_textInputs );
2004-03-23 06:33:01 +00:00
this->AddChild( &m_textInputs );
2005-05-09 04:17:17 +00:00
this->SortByDrawOrder();
2004-03-23 06:33:01 +00:00
}
ScreenTestLights::~ScreenTestLights()
{
LOG->Trace( "ScreenTestLights::~ScreenTestLights()" );
}
void ScreenTestLights::Update( float fDeltaTime )
{
Screen::Update( fDeltaTime );
2005-04-21 19:54:11 +00:00
if( m_timerBackToAutoCycle.Ago() > 20 )
{
m_timerBackToAutoCycle.Touch();
LIGHTSMAN->SetLightsMode( LIGHTSMODE_TEST_AUTO_CYCLE );
}
CabinetLight cl = LIGHTSMAN->GetFirstLitCabinetLight();
GameController gc;
GameButton gb;
LIGHTSMAN->GetFirstLitGameButtonLight( gc, gb );
2004-03-29 09:44:00 +00:00
2004-03-23 06:33:01 +00:00
CString s;
switch( LIGHTSMAN->GetLightsMode() )
{
case LIGHTSMODE_TEST_AUTO_CYCLE:
s += "Auto Cycle\n";
break;
case LIGHTSMODE_TEST_MANUAL_CYCLE:
s += "Manual Cycle\n";
break;
}
if( cl == LIGHT_INVALID )
s += "cabinet light: -----\n";
else
s += ssprintf( "cabinet light: %d %s\n", cl, CabinetLightToString(cl).c_str() );
if( gc == GAME_CONTROLLER_INVALID )
{
s += ssprintf( "controller light: -----\n" );
}
else
{
2006-01-08 19:38:33 +00:00
CString sGameButton = GameButtonToLocalizedString( GAMESTATE->GetCurrentGame(), gb );
s += ssprintf( "controller light: P%d %d %s\n", gc+1, gb, sGameButton.c_str() );
}
2004-03-23 06:33:01 +00:00
m_textInputs.SetText( s );
}
void ScreenTestLights::Input( const InputEventPlus &input )
2004-03-23 06:33:01 +00:00
{
if( input.type != IET_FIRST_PRESS && input.type != IET_SLOW_REPEAT )
2004-03-23 06:33:01 +00:00
return; // ignore
Screen::Input( input ); // default handler
2004-03-23 06:33:01 +00:00
}
void ScreenTestLights::HandleScreenMessage( const ScreenMessage SM )
{
switch( SM )
{
2005-07-12 02:21:28 +00:00
case SM_LoseFocus:
2005-04-21 19:54:11 +00:00
LIGHTSMAN->SetLightsMode( LIGHTSMODE_MENU );
2004-03-23 06:33:01 +00:00
break;
}
}
2005-04-21 19:54:11 +00:00
void ScreenTestLights::MenuLeft( PlayerNumber pn )
{
LIGHTSMAN->SetLightsMode( LIGHTSMODE_TEST_MANUAL_CYCLE );
if( pn == PLAYER_1 )
LIGHTSMAN->PrevTestCabinetLight();
else
LIGHTSMAN->PrevTestGameButtonLight();
2005-04-21 19:54:11 +00:00
m_timerBackToAutoCycle.Touch();
}
void ScreenTestLights::MenuRight( PlayerNumber pn )
{
LIGHTSMAN->SetLightsMode( LIGHTSMODE_TEST_MANUAL_CYCLE );
if( pn == PLAYER_1 )
LIGHTSMAN->NextTestCabinetLight();
else
LIGHTSMAN->NextTestGameButtonLight();
2005-04-21 19:54:11 +00:00
m_timerBackToAutoCycle.Touch();
}
2004-03-23 06:33:01 +00:00
void ScreenTestLights::MenuStart( PlayerNumber pn )
{
MenuBack(pn);
}
void ScreenTestLights::MenuBack( PlayerNumber pn )
{
if(!IsTransitioning())
2004-03-23 06:33:01 +00:00
{
SCREENMAN->PlayStartSound();
2005-05-09 03:42:18 +00:00
OFF_COMMAND( m_textInputs );
StartTransitioningScreen( SM_GoToPrevScreen );
2004-03-23 06:33:01 +00:00
}
}
2004-06-08 05:22:33 +00:00
/*
* (c) 2004 Chris Danford
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, and/or sell copies of the Software, and to permit persons to
* whom the Software is furnished to do so, provided that the above
* copyright notice(s) and this permission notice appear in all copies of
* the Software and that both the above copyright notice(s) and this
* permission notice appear in supporting documentation.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/