2006-09-30 22:41:27 +00:00
|
|
|
/* GameInput - An input event specific to an InputScheme defined by a logical controller and button. */
|
2004-05-31 22:42:12 +00:00
|
|
|
|
2006-09-02 20:17:17 +00:00
|
|
|
#ifndef GAME_INPUT_H
|
|
|
|
|
#define GAME_INPUT_H
|
2004-03-23 06:11:10 +00:00
|
|
|
|
2004-03-29 09:44:00 +00:00
|
|
|
#include "EnumHelper.h"
|
2004-03-23 06:11:10 +00:00
|
|
|
|
2006-09-30 08:24:05 +00:00
|
|
|
class InputScheme;
|
2005-04-24 02:15:41 +00:00
|
|
|
|
2002-07-27 19:29:51 +00:00
|
|
|
enum GameController
|
2002-04-16 17:31:00 +00:00
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
GAME_CONTROLLER_1 = 0, // left controller
|
2006-06-24 00:06:57 +00:00
|
|
|
GAME_CONTROLLER_2, // right controller
|
2006-09-26 20:57:31 +00:00
|
|
|
NUM_GameController, // leave this at the end
|
2006-09-26 20:59:40 +00:00
|
|
|
GameController_Invalid,
|
2002-04-16 17:31:00 +00:00
|
|
|
};
|
2006-10-07 08:56:58 +00:00
|
|
|
#define FOREACH_GameController( gc ) FOREACH_ENUM( GameController, gc )
|
2002-04-16 17:31:00 +00:00
|
|
|
|
2002-07-31 19:40:40 +00:00
|
|
|
typedef int GameButton;
|
2006-09-30 08:24:05 +00:00
|
|
|
RString GameButtonToString( const InputScheme* pInputs, GameButton i );
|
|
|
|
|
RString GameButtonToLocalizedString( const InputScheme* pInputs, GameButton i );
|
|
|
|
|
GameButton StringToGameButton( const InputScheme* pInputs, const RString& s );
|
2005-04-24 02:15:41 +00:00
|
|
|
|
2006-09-27 04:39:51 +00:00
|
|
|
const GameButton NUM_GameButton = 20;
|
2006-09-27 04:44:15 +00:00
|
|
|
const GameButton GameButton_Invalid = NUM_GameButton+1;
|
2006-10-07 08:56:58 +00:00
|
|
|
#define FOREACH_GameButton( gb ) FOREACH_ENUM( GameButton, gb )
|
2002-07-31 19:40:40 +00:00
|
|
|
|
|
|
|
|
enum // DanceButtons
|
2002-04-16 17:31:00 +00:00
|
|
|
{
|
2002-07-31 19:40:40 +00:00
|
|
|
DANCE_BUTTON_LEFT,
|
|
|
|
|
DANCE_BUTTON_RIGHT,
|
|
|
|
|
DANCE_BUTTON_UP,
|
|
|
|
|
DANCE_BUTTON_DOWN,
|
|
|
|
|
DANCE_BUTTON_UPLEFT,
|
|
|
|
|
DANCE_BUTTON_UPRIGHT,
|
|
|
|
|
DANCE_BUTTON_START,
|
2005-04-24 04:35:59 +00:00
|
|
|
DANCE_BUTTON_SELECT,
|
2002-07-31 19:40:40 +00:00
|
|
|
DANCE_BUTTON_BACK,
|
|
|
|
|
DANCE_BUTTON_MENULEFT,
|
|
|
|
|
DANCE_BUTTON_MENURIGHT,
|
|
|
|
|
DANCE_BUTTON_MENUUP,
|
|
|
|
|
DANCE_BUTTON_MENUDOWN,
|
2003-01-19 04:44:22 +00:00
|
|
|
DANCE_BUTTON_COIN,
|
2003-02-12 11:43:08 +00:00
|
|
|
DANCE_BUTTON_OPERATOR,
|
2002-07-31 19:40:40 +00:00
|
|
|
NUM_DANCE_BUTTONS, // leave this at the end
|
2002-04-16 17:31:00 +00:00
|
|
|
};
|
|
|
|
|
|
2002-07-31 19:40:40 +00:00
|
|
|
enum // PumpButtons
|
|
|
|
|
{
|
|
|
|
|
PUMP_BUTTON_UPLEFT,
|
|
|
|
|
PUMP_BUTTON_UPRIGHT,
|
|
|
|
|
PUMP_BUTTON_CENTER,
|
|
|
|
|
PUMP_BUTTON_DOWNLEFT,
|
|
|
|
|
PUMP_BUTTON_DOWNRIGHT,
|
|
|
|
|
PUMP_BUTTON_START,
|
2005-04-24 04:35:59 +00:00
|
|
|
PUMP_BUTTON_SELECT,
|
2002-07-31 19:40:40 +00:00
|
|
|
PUMP_BUTTON_BACK,
|
|
|
|
|
PUMP_BUTTON_MENULEFT,
|
|
|
|
|
PUMP_BUTTON_MENURIGHT,
|
|
|
|
|
PUMP_BUTTON_MENUUP,
|
|
|
|
|
PUMP_BUTTON_MENUDOWN,
|
2003-01-19 04:44:22 +00:00
|
|
|
PUMP_BUTTON_COIN,
|
2003-02-12 11:43:08 +00:00
|
|
|
PUMP_BUTTON_OPERATOR,
|
2002-07-31 19:40:40 +00:00
|
|
|
NUM_PUMP_BUTTONS, // leave this at the end
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum // EZ2Buttons
|
|
|
|
|
{
|
|
|
|
|
EZ2_BUTTON_FOOTUPLEFT,
|
|
|
|
|
EZ2_BUTTON_FOOTUPRIGHT,
|
|
|
|
|
EZ2_BUTTON_FOOTDOWN,
|
|
|
|
|
EZ2_BUTTON_HANDUPLEFT,
|
|
|
|
|
EZ2_BUTTON_HANDUPRIGHT,
|
|
|
|
|
EZ2_BUTTON_HANDLRLEFT,
|
|
|
|
|
EZ2_BUTTON_HANDLRRIGHT,
|
|
|
|
|
EZ2_BUTTON_START,
|
2005-04-24 04:35:59 +00:00
|
|
|
EZ2_BUTTON_SELECT,
|
2002-07-31 19:40:40 +00:00
|
|
|
EZ2_BUTTON_BACK,
|
|
|
|
|
EZ2_BUTTON_MENULEFT,
|
|
|
|
|
EZ2_BUTTON_MENURIGHT,
|
|
|
|
|
EZ2_BUTTON_MENUUP,
|
|
|
|
|
EZ2_BUTTON_MENUDOWN,
|
2003-01-19 04:44:22 +00:00
|
|
|
EZ2_BUTTON_COIN,
|
2003-02-12 11:43:08 +00:00
|
|
|
EZ2_BUTTON_OPERATOR,
|
2002-07-31 19:40:40 +00:00
|
|
|
NUM_EZ2_BUTTONS, // leave this at the end
|
|
|
|
|
};
|
|
|
|
|
|
2002-09-07 02:50:23 +00:00
|
|
|
enum // ParaButtons
|
|
|
|
|
{
|
|
|
|
|
PARA_BUTTON_LEFT,
|
|
|
|
|
PARA_BUTTON_UPLEFT,
|
|
|
|
|
PARA_BUTTON_UP,
|
|
|
|
|
PARA_BUTTON_UPRIGHT,
|
|
|
|
|
PARA_BUTTON_RIGHT,
|
|
|
|
|
PARA_BUTTON_START,
|
2005-04-24 04:35:59 +00:00
|
|
|
PARA_BUTTON_SELECT,
|
2002-09-07 02:50:23 +00:00
|
|
|
PARA_BUTTON_BACK,
|
|
|
|
|
PARA_BUTTON_MENULEFT,
|
|
|
|
|
PARA_BUTTON_MENURIGHT,
|
|
|
|
|
PARA_BUTTON_MENUUP,
|
|
|
|
|
PARA_BUTTON_MENUDOWN,
|
2003-01-19 04:44:22 +00:00
|
|
|
PARA_BUTTON_COIN,
|
2003-02-12 11:43:08 +00:00
|
|
|
PARA_BUTTON_OPERATOR,
|
2002-12-28 16:07:19 +00:00
|
|
|
NUM_PARA_BUTTONS, // leave this at the end
|
2002-09-07 02:50:23 +00:00
|
|
|
};
|
|
|
|
|
|
2002-12-28 16:07:19 +00:00
|
|
|
enum // 3DDX Buttons
|
|
|
|
|
{
|
|
|
|
|
DS3DDX_BUTTON_HANDLEFT,
|
|
|
|
|
DS3DDX_BUTTON_FOOTDOWNLEFT,
|
|
|
|
|
DS3DDX_BUTTON_FOOTUPLEFT,
|
|
|
|
|
DS3DDX_BUTTON_HANDUP,
|
|
|
|
|
DS3DDX_BUTTON_HANDDOWN,
|
|
|
|
|
DS3DDX_BUTTON_FOOTUPRIGHT,
|
|
|
|
|
DS3DDX_BUTTON_FOOTDOWNRIGHT,
|
|
|
|
|
DS3DDX_BUTTON_HANDRIGHT,
|
|
|
|
|
DS3DDX_BUTTON_START,
|
2005-04-24 04:35:59 +00:00
|
|
|
DS3DDX_BUTTON_SELECT,
|
2002-12-28 16:07:19 +00:00
|
|
|
DS3DDX_BUTTON_BACK,
|
|
|
|
|
DS3DDX_BUTTON_MENULEFT,
|
|
|
|
|
DS3DDX_BUTTON_MENURIGHT,
|
|
|
|
|
DS3DDX_BUTTON_MENUUP,
|
|
|
|
|
DS3DDX_BUTTON_MENUDOWN,
|
2003-01-19 04:44:22 +00:00
|
|
|
DS3DDX_BUTTON_COIN,
|
2003-02-12 11:43:08 +00:00
|
|
|
DS3DDX_BUTTON_OPERATOR,
|
2002-12-28 16:07:19 +00:00
|
|
|
NUM_DS3DDX_BUTTONS, // leave this at the end.
|
|
|
|
|
};
|
2002-07-31 19:40:40 +00:00
|
|
|
|
2005-10-07 05:00:52 +00:00
|
|
|
enum // BEAT Buttons
|
2003-01-01 17:20:36 +00:00
|
|
|
{
|
2005-10-07 05:00:52 +00:00
|
|
|
BEAT_BUTTON_KEY1,
|
|
|
|
|
BEAT_BUTTON_KEY2,
|
|
|
|
|
BEAT_BUTTON_KEY3,
|
|
|
|
|
BEAT_BUTTON_KEY4,
|
|
|
|
|
BEAT_BUTTON_KEY5,
|
|
|
|
|
BEAT_BUTTON_KEY6,
|
|
|
|
|
BEAT_BUTTON_KEY7,
|
|
|
|
|
BEAT_BUTTON_SCRATCHUP,
|
|
|
|
|
/* XXX special case: this button is an alias of BEAT_BUTTON_SCRATCHUP for track
|
2003-01-01 22:08:05 +00:00
|
|
|
* matching. */
|
2005-10-07 05:00:52 +00:00
|
|
|
BEAT_BUTTON_SCRATCHDOWN,
|
|
|
|
|
BEAT_BUTTON_START,
|
|
|
|
|
BEAT_BUTTON_SELECT,
|
|
|
|
|
BEAT_BUTTON_BACK,
|
|
|
|
|
BEAT_BUTTON_MENULEFT,
|
|
|
|
|
BEAT_BUTTON_MENURIGHT,
|
|
|
|
|
BEAT_BUTTON_MENUUP,
|
|
|
|
|
BEAT_BUTTON_MENUDOWN,
|
|
|
|
|
BEAT_BUTTON_COIN,
|
|
|
|
|
BEAT_BUTTON_OPERATOR,
|
|
|
|
|
NUM_BEAT_BUTTONS, // leave this at the end.
|
2003-01-01 17:20:36 +00:00
|
|
|
};
|
|
|
|
|
|
2003-09-03 04:30:29 +00:00
|
|
|
enum // ManiaxButtons
|
|
|
|
|
{
|
|
|
|
|
MANIAX_BUTTON_HANDUPLEFT,
|
|
|
|
|
MANIAX_BUTTON_HANDUPRIGHT,
|
|
|
|
|
MANIAX_BUTTON_HANDLRLEFT,
|
|
|
|
|
MANIAX_BUTTON_HANDLRRIGHT,
|
|
|
|
|
MANIAX_BUTTON_START,
|
2005-04-24 04:35:59 +00:00
|
|
|
MANIAX_BUTTON_SELECT,
|
2003-09-03 04:30:29 +00:00
|
|
|
MANIAX_BUTTON_BACK,
|
|
|
|
|
MANIAX_BUTTON_MENULEFT,
|
|
|
|
|
MANIAX_BUTTON_MENURIGHT,
|
|
|
|
|
MANIAX_BUTTON_MENUUP,
|
|
|
|
|
MANIAX_BUTTON_MENUDOWN,
|
|
|
|
|
MANIAX_BUTTON_COIN,
|
|
|
|
|
MANIAX_BUTTON_OPERATOR,
|
|
|
|
|
NUM_MANIAX_BUTTONS, // leave this at the end
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum // TechnoButtons
|
|
|
|
|
{
|
|
|
|
|
TECHNO_BUTTON_LEFT,
|
|
|
|
|
TECHNO_BUTTON_RIGHT,
|
|
|
|
|
TECHNO_BUTTON_UP,
|
|
|
|
|
TECHNO_BUTTON_DOWN,
|
|
|
|
|
TECHNO_BUTTON_UPLEFT,
|
|
|
|
|
TECHNO_BUTTON_UPRIGHT,
|
|
|
|
|
TECHNO_BUTTON_CENTER,
|
|
|
|
|
TECHNO_BUTTON_DOWNLEFT,
|
|
|
|
|
TECHNO_BUTTON_DOWNRIGHT,
|
|
|
|
|
TECHNO_BUTTON_START,
|
2005-04-24 04:35:59 +00:00
|
|
|
TECHNO_BUTTON_SELECT,
|
2003-09-03 04:30:29 +00:00
|
|
|
TECHNO_BUTTON_BACK,
|
|
|
|
|
TECHNO_BUTTON_MENULEFT,
|
|
|
|
|
TECHNO_BUTTON_MENURIGHT,
|
|
|
|
|
TECHNO_BUTTON_MENUUP,
|
|
|
|
|
TECHNO_BUTTON_MENUDOWN,
|
|
|
|
|
TECHNO_BUTTON_COIN,
|
|
|
|
|
TECHNO_BUTTON_OPERATOR,
|
|
|
|
|
NUM_TECHNO_BUTTONS, // leave this at the end
|
|
|
|
|
};
|
|
|
|
|
|
2003-10-07 00:01:32 +00:00
|
|
|
enum // PnM Buttons
|
|
|
|
|
{
|
2005-10-07 05:00:52 +00:00
|
|
|
POPN_BUTTON_LEFT_WHITE,
|
|
|
|
|
POPN_BUTTON_LEFT_YELLOW,
|
|
|
|
|
POPN_BUTTON_LEFT_GREEN,
|
|
|
|
|
POPN_BUTTON_LEFT_BLUE,
|
|
|
|
|
POPN_BUTTON_RED,
|
|
|
|
|
POPN_BUTTON_RIGHT_BLUE,
|
|
|
|
|
POPN_BUTTON_RIGHT_GREEN,
|
|
|
|
|
POPN_BUTTON_RIGHT_YELLOW,
|
|
|
|
|
POPN_BUTTON_RIGHT_WHITE,
|
|
|
|
|
POPN_BUTTON_START,
|
|
|
|
|
POPN_BUTTON_SELECT,
|
|
|
|
|
POPN_BUTTON_BACK,
|
|
|
|
|
POPN_BUTTON_MENULEFT,
|
|
|
|
|
POPN_BUTTON_MENURIGHT,
|
|
|
|
|
POPN_BUTTON_MENUUP,
|
|
|
|
|
POPN_BUTTON_MENUDOWN,
|
|
|
|
|
POPN_BUTTON_COIN,
|
|
|
|
|
POPN_BUTTON_OPERATOR,
|
|
|
|
|
NUM_POPN_BUTTONS, // leave this at the end
|
2003-10-07 00:01:32 +00:00
|
|
|
};
|
|
|
|
|
|
2004-04-20 02:35:30 +00:00
|
|
|
enum // LightsButtons
|
|
|
|
|
{
|
|
|
|
|
LIGHTS_BUTTON_MARQUEE_UP_LEFT,
|
|
|
|
|
LIGHTS_BUTTON_MARQUEE_UP_RIGHT,
|
|
|
|
|
LIGHTS_BUTTON_MARQUEE_LR_LEFT,
|
|
|
|
|
LIGHTS_BUTTON_MARQUEE_LR_RIGHT,
|
|
|
|
|
LIGHTS_BUTTON_BUTTONS_LEFT,
|
|
|
|
|
LIGHTS_BUTTON_BUTTONS_RIGHT,
|
|
|
|
|
LIGHTS_BUTTON_BASS_LEFT,
|
|
|
|
|
LIGHTS_BUTTON_BASS_RIGHT,
|
|
|
|
|
LIGHTS_BUTTON_START,
|
2005-04-24 04:35:59 +00:00
|
|
|
LIGHTS_BUTTON_SELECT,
|
2004-04-20 02:35:30 +00:00
|
|
|
LIGHTS_BUTTON_BACK,
|
|
|
|
|
LIGHTS_BUTTON_MENULEFT,
|
|
|
|
|
LIGHTS_BUTTON_MENURIGHT,
|
|
|
|
|
LIGHTS_BUTTON_MENUUP,
|
|
|
|
|
LIGHTS_BUTTON_MENUDOWN,
|
|
|
|
|
LIGHTS_BUTTON_COIN,
|
|
|
|
|
LIGHTS_BUTTON_OPERATOR,
|
|
|
|
|
NUM_LIGHTS_BUTTONS, // leave this at the end
|
|
|
|
|
};
|
2002-07-31 19:40:40 +00:00
|
|
|
|
2002-04-16 17:31:00 +00:00
|
|
|
|
|
|
|
|
struct GameInput
|
|
|
|
|
{
|
2006-09-27 04:44:15 +00:00
|
|
|
GameInput(): controller(GameController_Invalid), button(GameButton_Invalid) { }
|
2002-08-26 06:39:51 +00:00
|
|
|
|
|
|
|
|
GameInput( GameController c, GameButton b ): controller(c), button(b) { }
|
2002-04-16 17:31:00 +00:00
|
|
|
|
2002-07-31 19:40:40 +00:00
|
|
|
GameController controller;
|
2006-09-02 20:17:17 +00:00
|
|
|
GameButton button;
|
2002-04-16 17:31:00 +00:00
|
|
|
|
2005-06-08 04:46:31 +00:00
|
|
|
bool operator==( const GameInput &other ) const { return controller == other.controller && button == other.button; };
|
|
|
|
|
bool operator<( const GameInput &other ) const
|
|
|
|
|
{
|
|
|
|
|
if( controller < other.controller )
|
|
|
|
|
return true;
|
|
|
|
|
else if( controller > other.controller )
|
|
|
|
|
return false;
|
2006-09-14 05:53:13 +00:00
|
|
|
return button < other.button;
|
|
|
|
|
}
|
2002-04-16 17:31:00 +00:00
|
|
|
|
2006-09-26 20:59:40 +00:00
|
|
|
inline bool IsValid() const { return controller != GameController_Invalid; };
|
2006-09-27 04:44:15 +00:00
|
|
|
inline void MakeInvalid() { controller = GameController_Invalid; button = GameButton_Invalid; };
|
2002-04-16 17:31:00 +00:00
|
|
|
|
2006-09-30 08:24:05 +00:00
|
|
|
RString ToString( const InputScheme* pInputs ) const;
|
|
|
|
|
bool FromString( const InputScheme* pInputs, const RString &s );
|
2002-04-16 17:31:00 +00:00
|
|
|
};
|
|
|
|
|
|
2002-11-16 08:07:38 +00:00
|
|
|
#endif
|
2004-05-31 22:42:12 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* (c) 2001-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.
|
|
|
|
|
*/
|