Files
itgmania212121/stepmania/src/ScreenTestInput.cpp
T

156 lines
4.1 KiB
C++
Raw Normal View History

2003-10-11 07:47:34 +00:00
#include "global.h"
#include "ScreenTestInput.h"
#include "ScreenManager.h"
#include "RageLog.h"
#include "InputMapper.h"
#include "GameState.h"
2004-07-08 00:10:34 +00:00
#include "GameSoundManager.h"
2003-10-11 07:47:34 +00:00
#include "ThemeManager.h"
2004-07-25 17:07:32 +00:00
#include "Game.h"
#include "ScreenDimensions.h"
#include "GameManager.h"
2005-04-23 22:50:13 +00:00
#include "PrefsManager.h"
2003-10-11 07:47:34 +00:00
2004-11-26 17:28:47 +00:00
REGISTER_SCREEN_CLASS( ScreenTestInput );
ScreenTestInput::ScreenTestInput( CString sClassName ) : ScreenWithMenuElements( sClassName )
2003-10-11 07:47:34 +00:00
{
LOG->Trace( "ScreenTestInput::ScreenTestInput()" );
}
void ScreenTestInput::Init()
{
ScreenWithMenuElements::Init();
2003-10-11 07:47:34 +00:00
2005-02-06 03:32:53 +00:00
m_textInputs.LoadFromFont( THEME->GetPathF("Common","normal") );
2005-04-23 22:50:13 +00:00
m_textInputs.SetXY( SCREEN_CENTER_X-250, SCREEN_CENTER_Y );
2003-10-11 07:47:34 +00:00
m_textInputs.SetDiffuse( RageColor(1,1,1,1) );
2005-04-23 22:50:13 +00:00
m_textInputs.SetZoom( 0.7f );
m_textInputs.SetHorizAlign( Actor::align_left );
2003-10-11 07:47:34 +00:00
this->AddChild( &m_textInputs );
2005-05-09 04:17:17 +00:00
this->SortByDrawOrder();
2003-10-11 07:47:34 +00:00
}
ScreenTestInput::~ScreenTestInput()
{
LOG->Trace( "ScreenTestInput::~ScreenTestInput()" );
}
void ScreenTestInput::Update( float fDeltaTime )
{
Screen::Update( fDeltaTime );
CStringArray asInputs;
DeviceInput di;
2005-04-24 02:15:41 +00:00
FOREACH_InputDevice( d )
2003-10-11 07:47:34 +00:00
{
2005-04-24 02:15:41 +00:00
for( int b=0; b<GetNumDeviceButtons(d); b++ )
2003-10-11 07:47:34 +00:00
{
2005-04-24 02:15:41 +00:00
di.device = d;
2003-10-11 07:47:34 +00:00
di.button = b;
2005-05-08 08:54:35 +00:00
if( !INPUTFILTER->IsBeingPressed(di) )
continue;
CString sTemp;
sTemp += di.toString();
GameInput gi;
if( INPUTMAPPER->DeviceToGame(di,gi) )
2003-10-11 07:47:34 +00:00
{
2005-05-08 08:54:35 +00:00
CString sName = GAMESTATE->GetCurrentGame()->m_szButtonNames[gi.button];
sTemp += ssprintf(" - Controller %d %s", gi.controller+1, sName.c_str() );
if( !PREFSMAN->m_bOnlyDedicatedMenuButtons )
2003-10-11 08:52:07 +00:00
{
2005-05-08 08:54:35 +00:00
CString sSecondary = GAMEMAN->GetMenuButtonSecondaryFunction( GAMESTATE->GetCurrentGame(), gi.button );
if( !sSecondary.empty() )
sTemp += ssprintf(" - (%s secondary)", sSecondary.c_str() );
2003-10-11 07:47:34 +00:00
}
}
2005-05-08 08:54:35 +00:00
else
{
sTemp += " - not mapped";
}
2005-05-08 09:19:35 +00:00
CString sComment = INPUTFILTER->GetButtonComment( di );
if( sComment != "" )
sTemp += " - " + sComment;
2005-05-08 08:54:35 +00:00
asInputs.push_back( sTemp );
2003-10-11 07:47:34 +00:00
}
}
2005-04-23 22:50:13 +00:00
m_textInputs.SetText( join( "\n", asInputs ) );
2003-10-11 07:47:34 +00:00
}
void ScreenTestInput::DrawPrimitives()
{
Screen::DrawPrimitives();
}
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;
}
}
2003-10-11 08:52:07 +00:00
void ScreenTestInput::MenuStart( PlayerNumber pn )
{
2003-12-20 21:36:09 +00:00
MenuBack(pn);
2003-10-11 08:52:07 +00:00
}
void ScreenTestInput::MenuBack( PlayerNumber pn )
{
if(!IsTransitioning())
2003-10-11 08:52:07 +00:00
{
SCREENMAN->PlayStartSound();
StartTransitioning( SM_GoToPrevScreen );
2003-10-11 08:52:07 +00:00
}
}
2004-06-08 05:22:33 +00:00
/*
* (c) 2003-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.
*/