Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

GameInput.h

Go to the documentation of this file.
00001 /* GameInput - An input event specific to a Game definied by an instrument and a button space. */ 00002 00003 #ifndef GAMEINPUT_H 00004 #define GAMEINPUT_H 00005 00006 #include "EnumHelper.h" 00007 00008 enum GameController 00009 { 00010 GAME_CONTROLLER_1 = 0, // left controller 00011 GAME_CONTROLLER_2, // right controller 00012 MAX_GAME_CONTROLLERS, // leave this at the end 00013 GAME_CONTROLLER_INVALID, 00014 }; 00015 #define FOREACH_GameController( gc ) FOREACH_ENUM( GameController, MAX_GAME_CONTROLLERS, gc ) 00016 00017 typedef int GameButton; 00018 const GameButton MAX_GAME_BUTTONS = 20; 00019 const GameButton GAME_BUTTON_INVALID = MAX_GAME_BUTTONS+1; 00020 #define FOREACH_GameButton( gb ) FOREACH_ENUM( GameButton, MAX_GAME_BUTTONS, gb ) 00021 00022 enum // DanceButtons 00023 { 00024 DANCE_BUTTON_LEFT, 00025 DANCE_BUTTON_RIGHT, 00026 DANCE_BUTTON_UP, 00027 DANCE_BUTTON_DOWN, 00028 DANCE_BUTTON_UPLEFT, 00029 DANCE_BUTTON_UPRIGHT, 00030 DANCE_BUTTON_START, 00031 DANCE_BUTTON_BACK, 00032 DANCE_BUTTON_MENULEFT, 00033 DANCE_BUTTON_MENURIGHT, 00034 DANCE_BUTTON_MENUUP, 00035 DANCE_BUTTON_MENUDOWN, 00036 DANCE_BUTTON_COIN, 00037 DANCE_BUTTON_OPERATOR, 00038 NUM_DANCE_BUTTONS, // leave this at the end 00039 }; 00040 00041 enum // PumpButtons 00042 { 00043 PUMP_BUTTON_UPLEFT, 00044 PUMP_BUTTON_UPRIGHT, 00045 PUMP_BUTTON_CENTER, 00046 PUMP_BUTTON_DOWNLEFT, 00047 PUMP_BUTTON_DOWNRIGHT, 00048 PUMP_BUTTON_START, 00049 PUMP_BUTTON_BACK, 00050 PUMP_BUTTON_MENULEFT, 00051 PUMP_BUTTON_MENURIGHT, 00052 PUMP_BUTTON_MENUUP, 00053 PUMP_BUTTON_MENUDOWN, 00054 PUMP_BUTTON_COIN, 00055 PUMP_BUTTON_OPERATOR, 00056 NUM_PUMP_BUTTONS, // leave this at the end 00057 }; 00058 00059 enum // EZ2Buttons 00060 { 00061 EZ2_BUTTON_FOOTUPLEFT, 00062 EZ2_BUTTON_FOOTUPRIGHT, 00063 EZ2_BUTTON_FOOTDOWN, 00064 EZ2_BUTTON_HANDUPLEFT, 00065 EZ2_BUTTON_HANDUPRIGHT, 00066 EZ2_BUTTON_HANDLRLEFT, 00067 EZ2_BUTTON_HANDLRRIGHT, 00068 EZ2_BUTTON_START, 00069 EZ2_BUTTON_BACK, 00070 EZ2_BUTTON_MENULEFT, 00071 EZ2_BUTTON_MENURIGHT, 00072 EZ2_BUTTON_MENUUP, 00073 EZ2_BUTTON_MENUDOWN, 00074 EZ2_BUTTON_COIN, 00075 EZ2_BUTTON_OPERATOR, 00076 NUM_EZ2_BUTTONS, // leave this at the end 00077 }; 00078 00079 enum // ParaButtons 00080 { 00081 PARA_BUTTON_LEFT, 00082 PARA_BUTTON_UPLEFT, 00083 PARA_BUTTON_UP, 00084 PARA_BUTTON_UPRIGHT, 00085 PARA_BUTTON_RIGHT, 00086 PARA_BUTTON_START, 00087 PARA_BUTTON_BACK, 00088 PARA_BUTTON_MENULEFT, 00089 PARA_BUTTON_MENURIGHT, 00090 PARA_BUTTON_MENUUP, 00091 PARA_BUTTON_MENUDOWN, 00092 PARA_BUTTON_COIN, 00093 PARA_BUTTON_OPERATOR, 00094 NUM_PARA_BUTTONS, // leave this at the end 00095 }; 00096 00097 enum // 3DDX Buttons 00098 { 00099 DS3DDX_BUTTON_HANDLEFT, 00100 DS3DDX_BUTTON_FOOTDOWNLEFT, 00101 DS3DDX_BUTTON_FOOTUPLEFT, 00102 DS3DDX_BUTTON_HANDUP, 00103 DS3DDX_BUTTON_HANDDOWN, 00104 DS3DDX_BUTTON_FOOTUPRIGHT, 00105 DS3DDX_BUTTON_FOOTDOWNRIGHT, 00106 DS3DDX_BUTTON_HANDRIGHT, 00107 DS3DDX_BUTTON_START, 00108 DS3DDX_BUTTON_BACK, 00109 DS3DDX_BUTTON_MENULEFT, 00110 DS3DDX_BUTTON_MENURIGHT, 00111 DS3DDX_BUTTON_MENUUP, 00112 DS3DDX_BUTTON_MENUDOWN, 00113 DS3DDX_BUTTON_COIN, 00114 DS3DDX_BUTTON_OPERATOR, 00115 NUM_DS3DDX_BUTTONS, // leave this at the end. 00116 }; 00117 00118 enum // BM Buttons 00119 { 00120 BM_BUTTON_KEY1, 00121 BM_BUTTON_KEY2, 00122 BM_BUTTON_KEY3, 00123 BM_BUTTON_KEY4, 00124 BM_BUTTON_KEY5, 00125 BM_BUTTON_KEY6, 00126 BM_BUTTON_KEY7, 00127 BM_BUTTON_SCRATCHUP, 00128 /* XXX special case: this button is an alias of BM_BUTTON_SCRATCHUP for track 00129 * matching. */ 00130 BM_BUTTON_SCRATCHDOWN, 00131 BM_BUTTON_START, 00132 BM_BUTTON_BACK, 00133 BM_BUTTON_MENULEFT, 00134 BM_BUTTON_MENURIGHT, 00135 BM_BUTTON_MENUUP, 00136 BM_BUTTON_MENUDOWN, 00137 BM_BUTTON_COIN, 00138 BM_BUTTON_OPERATOR, 00139 NUM_BM_BUTTONS, // leave this at the end. 00140 }; 00141 00142 enum // ManiaxButtons 00143 { 00144 MANIAX_BUTTON_HANDUPLEFT, 00145 MANIAX_BUTTON_HANDUPRIGHT, 00146 MANIAX_BUTTON_HANDLRLEFT, 00147 MANIAX_BUTTON_HANDLRRIGHT, 00148 MANIAX_BUTTON_START, 00149 MANIAX_BUTTON_BACK, 00150 MANIAX_BUTTON_MENULEFT, 00151 MANIAX_BUTTON_MENURIGHT, 00152 MANIAX_BUTTON_MENUUP, 00153 MANIAX_BUTTON_MENUDOWN, 00154 MANIAX_BUTTON_COIN, 00155 MANIAX_BUTTON_OPERATOR, 00156 NUM_MANIAX_BUTTONS, // leave this at the end 00157 }; 00158 00159 enum // TechnoButtons 00160 { 00161 TECHNO_BUTTON_LEFT, 00162 TECHNO_BUTTON_RIGHT, 00163 TECHNO_BUTTON_UP, 00164 TECHNO_BUTTON_DOWN, 00165 TECHNO_BUTTON_UPLEFT, 00166 TECHNO_BUTTON_UPRIGHT, 00167 TECHNO_BUTTON_CENTER, 00168 TECHNO_BUTTON_DOWNLEFT, 00169 TECHNO_BUTTON_DOWNRIGHT, 00170 TECHNO_BUTTON_START, 00171 TECHNO_BUTTON_BACK, 00172 TECHNO_BUTTON_MENULEFT, 00173 TECHNO_BUTTON_MENURIGHT, 00174 TECHNO_BUTTON_MENUUP, 00175 TECHNO_BUTTON_MENUDOWN, 00176 TECHNO_BUTTON_COIN, 00177 TECHNO_BUTTON_OPERATOR, 00178 NUM_TECHNO_BUTTONS, // leave this at the end 00179 }; 00180 00181 enum // PnM Buttons 00182 { 00183 PNM_BUTTON_LEFT_WHITE, 00184 PNM_BUTTON_LEFT_YELLOW, 00185 PNM_BUTTON_LEFT_GREEN, 00186 PNM_BUTTON_LEFT_BLUE, 00187 PNM_BUTTON_RED, 00188 PNM_BUTTON_RIGHT_BLUE, 00189 PNM_BUTTON_RIGHT_GREEN, 00190 PNM_BUTTON_RIGHT_YELLOW, 00191 PNM_BUTTON_RIGHT_WHITE, 00192 PNM_BUTTON_START, 00193 PNM_BUTTON_BACK, 00194 PNM_BUTTON_MENULEFT, 00195 PNM_BUTTON_MENURIGHT, 00196 PNM_BUTTON_MENUUP, 00197 PNM_BUTTON_MENUDOWN, 00198 PNM_BUTTON_COIN, 00199 PNM_BUTTON_OPERATOR, 00200 NUM_PNM_BUTTONS, // leave this at the end 00201 }; 00202 00203 enum // LightsButtons 00204 { 00205 LIGHTS_BUTTON_MARQUEE_UP_LEFT, 00206 LIGHTS_BUTTON_MARQUEE_UP_RIGHT, 00207 LIGHTS_BUTTON_MARQUEE_LR_LEFT, 00208 LIGHTS_BUTTON_MARQUEE_LR_RIGHT, 00209 LIGHTS_BUTTON_BUTTONS_LEFT, 00210 LIGHTS_BUTTON_BUTTONS_RIGHT, 00211 LIGHTS_BUTTON_BASS_LEFT, 00212 LIGHTS_BUTTON_BASS_RIGHT, 00213 LIGHTS_BUTTON_START, 00214 LIGHTS_BUTTON_BACK, 00215 LIGHTS_BUTTON_MENULEFT, 00216 LIGHTS_BUTTON_MENURIGHT, 00217 LIGHTS_BUTTON_MENUUP, 00218 LIGHTS_BUTTON_MENUDOWN, 00219 LIGHTS_BUTTON_COIN, 00220 LIGHTS_BUTTON_OPERATOR, 00221 NUM_LIGHTS_BUTTONS, // leave this at the end 00222 }; 00223 00224 00225 struct GameInput 00226 { 00227 GameInput(): controller(GAME_CONTROLLER_INVALID), button(GAME_BUTTON_INVALID) { } 00228 00229 GameInput( GameController c, GameButton b ): controller(c), button(b) { } 00230 00231 GameController controller; 00232 GameButton button; 00233 00234 bool operator==( const GameInput &other ) { return controller == other.controller && button == other.button; }; 00235 00236 inline bool IsValid() const { return controller != GAME_CONTROLLER_INVALID; }; 00237 inline void MakeInvalid() { controller = GAME_CONTROLLER_INVALID; button = GAME_BUTTON_INVALID; }; 00238 00239 CString toString(); 00240 bool fromString( CString s ); 00241 }; 00242 00243 #endif 00244 00245 /* 00246 * (c) 2001-2004 Chris Danford 00247 * All rights reserved. 00248 * 00249 * Permission is hereby granted, free of charge, to any person obtaining a 00250 * copy of this software and associated documentation files (the 00251 * "Software"), to deal in the Software without restriction, including 00252 * without limitation the rights to use, copy, modify, merge, publish, 00253 * distribute, and/or sell copies of the Software, and to permit persons to 00254 * whom the Software is furnished to do so, provided that the above 00255 * copyright notice(s) and this permission notice appear in all copies of 00256 * the Software and that both the above copyright notice(s) and this 00257 * permission notice appear in supporting documentation. 00258 * 00259 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00260 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00261 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00262 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00263 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00264 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00265 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00266 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00267 * PERFORMANCE OF THIS SOFTWARE. 00268 */

Generated on Thu Jan 27 20:57:20 2005 for StepMania by doxygen 1.3.7