00001 /* Crown and Cutlass 00002 * Main Menu Class Header 00003 */ 00004 00005 #if !defined( _MAINMENU_H_ ) 00006 00007 #define _MAINMENU_H_ 00008 00009 #include <guichan.hpp> 00010 #include "SDL.h" 00011 #include "AL/al.h" 00012 #include "IGameState.h" 00013 #include "Callback.h" 00014 #include "SoundStream.h" 00015 00016 // So I don't have to include the headers 00017 class StateSailing; 00018 class Texture; 00019 class CCButton; 00020 class CCTable; 00021 class CCTextField; 00022 00023 class MainMenu: public IGameState { 00024 public: 00025 // Constructor 00026 MainMenu(bool *done); 00027 00028 // Destructor 00029 ~MainMenu(); 00030 00031 // Need to implement the Update and Display functions 00032 void Update(const unsigned int ticks); 00033 void Display(); 00034 00035 // Need to implement the switchTo function 00036 void SwitchTo(IGameState *oldState); 00037 00038 // Need to implement the switchFrom function 00039 void SwitchFrom(); 00040 00041 // Override the exit function 00042 void DoExit(); 00043 00044 // Callback Functions 00045 void ContinueGame(int i); 00046 void NewGame(int i); 00047 void SaveGame(int i); 00048 void LoadGame(int i); 00049 void Exit(int i); 00050 void Accept(int i); 00051 void Cancel(int i); 00052 00053 void SetMainGame(StateSailing *sailingState); 00054 00055 private: 00056 // Set to false to exit 00057 bool *m_done; 00058 00059 // Check sdl input 00060 void CheckInput(); 00061 00062 void ResetNewGameMenu(); 00063 00064 // Main sailing game state 00065 StateSailing *m_mainGame; 00066 00067 // Callback functions 00068 TCallback<MainMenu> m_contCallback; 00069 TCallback<MainMenu> m_newCallback; 00070 TCallback<MainMenu> m_saveCallback; 00071 TCallback<MainMenu> m_loadCallback; 00072 TCallback<MainMenu> m_exitCallback; 00073 00074 // New game callback functions 00075 TCallback<MainMenu> m_acceptCallback; 00076 TCallback<MainMenu> m_cancelCallback; 00077 00078 // Background image texture 00079 Texture *m_background; 00080 00081 // OpenAL stuff 00082 SoundStream m_music; 00083 00084 // Guichan widgets 00085 // For main menu 00086 gcn::Container *m_mainMenu; 00087 CCTable* m_mainMenuTable; 00088 CCButton* m_contButton; 00089 CCButton* m_exitButton; 00090 CCButton* m_loadButton; 00091 CCButton* m_newButton; 00092 CCButton* m_saveButton; 00093 00094 // For new game menu 00095 gcn::Container *m_newGameMenu; 00096 CCTable* m_newGameTable; 00097 CCButton* m_acceptButton; 00098 CCButton* m_cancelButton; 00099 CCTextField* m_nameText; 00100 CCTextField* m_shipText; 00101 00102 // Font names 00103 static const std::string s_mainFontName; 00104 static const std::string s_highlightFontName; 00105 static const std::string s_disabledFontName; 00106 static const std::string s_smallFontName; 00107 }; 00108 00109 #endif
1.4.7