00001 /* MenuInput - An input event specific to a menu navigation. This is generated based on a Game. */ 00002 00003 #ifndef MENUINPUT_H 00004 #define MENUINPUT_H 00005 00006 #include "PlayerNumber.h" 00007 00008 enum MenuButton 00009 { 00010 MENU_BUTTON_LEFT = 0, 00011 MENU_BUTTON_RIGHT, 00012 MENU_BUTTON_UP, 00013 MENU_BUTTON_DOWN, 00014 MENU_BUTTON_START, 00015 MENU_BUTTON_BACK, 00016 MENU_BUTTON_COIN, 00017 MENU_BUTTON_OPERATOR, 00018 NUM_MENU_BUTTONS, // leave this at the end 00019 MENU_BUTTON_INVALID 00020 }; 00021 #define FOREACH_MenuButton( m ) FOREACH_ENUM( MenuButton, NUM_MENU_BUTTONS, m ) 00022 00023 struct MenuInput 00024 { 00025 MenuInput() { MakeInvalid(); }; 00026 MenuInput( PlayerNumber pn, MenuButton b ) { player = pn; button = b; }; 00027 00028 PlayerNumber player; 00029 MenuButton button; 00030 00031 // bool operator==( const MenuInput &other ) { return player == other.player && button == other.button; }; 00032 00033 inline bool IsValid() const { return player != PLAYER_INVALID; }; 00034 inline void MakeInvalid() { player = PLAYER_INVALID; button = MENU_BUTTON_INVALID; }; 00035 }; 00036 00037 #endif 00038 00039 /* 00040 * (c) 2001-2004 Chris Danford, Glenn Maynard 00041 * All rights reserved. 00042 * 00043 * Permission is hereby granted, free of charge, to any person obtaining a 00044 * copy of this software and associated documentation files (the 00045 * "Software"), to deal in the Software without restriction, including 00046 * without limitation the rights to use, copy, modify, merge, publish, 00047 * distribute, and/or sell copies of the Software, and to permit persons to 00048 * whom the Software is furnished to do so, provided that the above 00049 * copyright notice(s) and this permission notice appear in all copies of 00050 * the Software and that both the above copyright notice(s) and this 00051 * permission notice appear in supporting documentation. 00052 * 00053 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00054 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00055 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00056 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00057 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00058 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00059 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00060 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00061 * PERFORMANCE OF THIS SOFTWARE. 00062 */