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

ScreenMiniMenu.h

Go to the documentation of this file.
00001 /* ScreenMiniMenu - Displays a prompt over the top of another screen. Call SCREENMAN->AddScreenToTop( new ScreenMiniMenu(...) ); */ 00002 00003 #ifndef SCREEN_MINI_MENU_H 00004 #define SCREEN_MINI_MENU_H 00005 00006 #include "Screen.h" 00007 #include "BitmapText.h" 00008 #include "Transition.h" 00009 #include "Quad.h" 00010 #include "RandomSample.h" 00011 #include "BGAnimation.h" 00012 00013 #define MAX_MENU_ROWS 40 00014 00015 00016 struct MenuRow 00017 { 00018 const char *name; 00019 bool enabled; 00020 int defaultChoice; 00021 const char *choices[32]; 00022 }; 00023 00024 00025 struct MenuRowInternal 00026 { 00027 CString name; 00028 bool enabled; 00029 int defaultChoice; 00030 vector<CString> choices; 00031 00032 MenuRowInternal() 00033 { 00034 enabled = true; 00035 defaultChoice = 0; 00036 } 00037 00038 MenuRowInternal( const MenuRow &r ); 00039 00040 void SetDefaultChoiceIfPresent( const CString &s ); 00041 }; 00042 00043 00044 struct Menu 00045 { 00046 CString title; 00047 vector<MenuRowInternal> rows; 00048 00049 Menu() {} 00050 Menu( CString t, const MenuRow *rows ); 00051 }; 00052 00053 00054 class ScreenMiniMenu : public Screen 00055 { 00056 public: 00057 ScreenMiniMenu( CString sName ); 00058 ScreenMiniMenu( Menu* pDef, ScreenMessage SM_SendOnOK, ScreenMessage SM_SendOnCancel ); 00059 00060 virtual void Update( float fDeltaTime ); 00061 virtual void DrawPrimitives(); 00062 virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); 00063 virtual void HandleScreenMessage( const ScreenMessage SM ); 00064 00065 protected: 00066 void MenuUp( PlayerNumber pn, const InputEventType type ); 00067 void MenuDown( PlayerNumber pn, const InputEventType type ); 00068 void MenuLeft( PlayerNumber pn, const InputEventType type ); 00069 void MenuRight( PlayerNumber pn, const InputEventType type ); 00070 void MenuBack( PlayerNumber pn ); 00071 void MenuStart( PlayerNumber pn, const InputEventType type ); 00072 00073 int GetGoUpSpot(); // return -1 if can't go up 00074 int GetGoDownSpot(); // return -1 if can't go down 00075 bool CanGoLeft(); 00076 bool CanGoRight(); 00077 00078 00079 void BeforeLineChanged(); 00080 void AfterLineChanged(); 00081 void AfterAnswerChanged(); 00082 00083 BGAnimation m_Background; 00084 Menu m_Def; 00085 BitmapText m_textTitle; 00086 BitmapText m_textLabel[MAX_MENU_ROWS]; 00087 BitmapText m_textAnswer[MAX_MENU_ROWS]; 00088 int m_iCurLine; 00089 int m_iCurAnswers[MAX_MENU_ROWS]; 00090 ScreenMessage m_SMSendOnOK, m_SMSendOnCancel; 00091 Transition m_In; 00092 Transition m_Out; 00093 00094 public: 00095 static int s_iLastLine; 00096 static int s_iLastAnswers[MAX_MENU_ROWS]; 00097 00098 }; 00099 00100 #endif 00101 00102 /* 00103 * (c) 2003-2004 Chris Danford 00104 * All rights reserved. 00105 * 00106 * Permission is hereby granted, free of charge, to any person obtaining a 00107 * copy of this software and associated documentation files (the 00108 * "Software"), to deal in the Software without restriction, including 00109 * without limitation the rights to use, copy, modify, merge, publish, 00110 * distribute, and/or sell copies of the Software, and to permit persons to 00111 * whom the Software is furnished to do so, provided that the above 00112 * copyright notice(s) and this permission notice appear in all copies of 00113 * the Software and that both the above copyright notice(s) and this 00114 * permission notice appear in supporting documentation. 00115 * 00116 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00117 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00118 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00119 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00120 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00121 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00122 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00123 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00124 * PERFORMANCE OF THIS SOFTWARE. 00125 */

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