/* GameInput - An input event specific to an InputScheme defined by a logical controller and button. */ #ifndef GAME_INPUT_H #define GAME_INPUT_H #include "EnumHelper.h" class InputScheme; enum GameController { GameController_1 = 0, // left controller GameController_2, // right controller NUM_GameController, // leave this at the end GameController_Invalid, }; const RString& GameControllerToString( GameController mp ); LuaDeclareType( GameController ); enum GameButton { GAME_BUTTON_MENULEFT, GAME_BUTTON_MENURIGHT, GAME_BUTTON_MENUUP, GAME_BUTTON_MENUDOWN, GAME_BUTTON_START, GAME_BUTTON_SELECT, GAME_BUTTON_BACK, GAME_BUTTON_COIN, GAME_BUTTON_OPERATOR, GAME_BUTTON_EFFECT_UP, GAME_BUTTON_EFFECT_DOWN, GAME_BUTTON_CUSTOM_01, GAME_BUTTON_CUSTOM_02, GAME_BUTTON_CUSTOM_03, GAME_BUTTON_CUSTOM_04, GAME_BUTTON_CUSTOM_05, GAME_BUTTON_CUSTOM_06, GAME_BUTTON_CUSTOM_07, GAME_BUTTON_CUSTOM_08, GAME_BUTTON_CUSTOM_09, GAME_BUTTON_CUSTOM_10, GAME_BUTTON_CUSTOM_11, GAME_BUTTON_CUSTOM_12, GAME_BUTTON_CUSTOM_13, GAME_BUTTON_CUSTOM_14, GAME_BUTTON_CUSTOM_15, GAME_BUTTON_CUSTOM_16, GAME_BUTTON_CUSTOM_17, GAME_BUTTON_CUSTOM_18, GAME_BUTTON_CUSTOM_19, NUM_GameButton, GameButton_Invalid }; RString GameButtonToString( const InputScheme* pInputs, GameButton i ); RString GameButtonToLocalizedString( const InputScheme* pInputs, GameButton i ); GameButton StringToGameButton( const InputScheme* pInputs, const RString& s ); #define FOREACH_GameButton_Custom( gb ) for( GameButton gb=GAME_BUTTON_CUSTOM_01; gb other.controller ) return false; return button < other.button; } inline bool IsValid() const { return controller != GameController_Invalid && button != GameButton_Invalid; }; inline void MakeInvalid() { controller = GameController_Invalid; button = GameButton_Invalid; }; RString ToString( const InputScheme* pInputs ) const; bool FromString( const InputScheme* pInputs, const RString &s ); }; #endif /* * (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. */