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

Menu.h

Go to the documentation of this file.
00001 
00007 #ifndef _SCENE_MENU_H_
00008 #define _SCENE_MENU_H_
00009 
00010 #include "Scene.h"
00011 #include "GGlobals.h"
00012 #include "../Math/Vector.h"
00013 #include "../Util/Objects/Sphere.h"
00014 #include "../Util/Objects/Box.h"
00015 #include "../Util/Objects/Cubemap.h"
00016 #include "../Util/Objects/Tube.h"
00017 #include "../Util/OpenGL/OpenGLParticleSystem.h"
00018 #include "../Sound/Sound.h"
00019 
00020 #define MENUS                   5
00021 #define MENU_MAIN               0
00022 #define MENU_CREATE             1
00023 #define MENU_JOIN               2
00024 #define MENU_SETTINGS   3
00025 #define MENU_CREDITS    4
00026 
00027 #define MENU_MAIN_SELECTIONS    5
00028 #define MENU_MAIN_CREDITS               0
00029 #define MENU_MAIN_CREATE                1
00030 #define MENU_MAIN_JOIN                  2
00031 #define MENU_MAIN_SETTINGS              3
00032 #define MENU_MAIN_EXIT                  4
00033 
00034 #define MENU_MAIN_TEXTURES      (MENU_MAIN_SELECTIONS*2)
00035 
00036 #define MENU_TEXTURES                   9
00037 #define MENU_TEX_CUBEMAP                0
00038 #define MENU_TEX_SELECTION              1
00039 #define MENU_TEX_PARTICLE               2
00040 #define MENU_TEX_SERVER_NAME    3
00041 #define MENU_TEX_PLAYER_NAME    4
00042 #define MENU_TEX_PORT_NUMBER    5
00043 #define MENU_TEX_MAX_PLAYERS    6
00044 #define MENU_TEX_SUBMIT                 7
00045 #define MENU_TEX_SERVER_IP              8
00046 
00047 #define MENU_OBJECTS            5
00048 #define MENU_OBJ_CUBEMAP        0
00049 #define MENU_OBJ_SPHERE         1
00050 #define MENU_OBJ_BOX            2
00051 #define MENU_OBJ_PLANET         3
00052 #define MENU_OBJ_TUBE           4
00053 
00054 #define MENU_SOUNDS                     2
00055 #define MENU_SOUND_SELECT       0
00056 #define MENU_SOUND_DOSELECT     1
00057 
00058 #define MENU_PLANETS            20
00059 
00060 #define MENU_LIGHTS                     2
00061 
00062 #define MENU_SELECTION_NONE (-1)
00063 
00064 #define MENU_INPUT_TYPE_STR                             0
00065 #define MENU_INPUT_TYPE_INT                             1
00066 #define MENU_INPUT_TYPE_STR_INT                 2
00067 #define MENU_INPUT_TYPE_SUBMIT                  3
00068 #define MENU_INPUT_TYPE_MODEL                   4
00069 
00070 #define MENU_INPUTS                                             11
00071 
00072 #define MENU_INPUT_CREATE_INPUT_MIN     0
00073 #define MENU_INPUT_CREATE_INPUT_MAX     5
00074 #define MENU_INPUT_CREATE_SERVER_NAME   0
00075 #define MENU_INPUT_CREATE_PORT                  1
00076 #define MENU_INPUT_CREATE_MAX_PLAYERS   2
00077 #define MENU_INPUT_CREATE_PLAYER_NAME   3
00078 #define MENU_INPUT_CREATE_MODEL                 4
00079 #define MENU_INPUT_CREATE_SUBMIT                5
00080 
00081 #define MENU_INPUT_JOIN_INPUT_MIN       6
00082 #define MENU_INPUT_JOIN_INPUT_MAX       10
00083 #define MENU_INPUT_JOIN_SERVER_IP               6
00084 #define MENU_INPUT_JOIN_PORT                    7
00085 #define MENU_INPUT_JOIN_PLAYER_NAME             8
00086 #define MENU_INPUT_JOIN_MODEL                   9
00087 #define MENU_INPUT_JOIN_SUBMIT                  10
00088 
00089 struct SMenuPlanets {
00090         float speed;
00091         float dist;
00092         Vec3 rotation;
00093 };
00094 
00095 struct SMenuInput {
00096         unsigned int type;
00097         String str;
00098         int strMin;
00099         int strMax;
00100         int val;
00101         int valMin;
00102         int valMax;
00103 };
00104 
00105 class Menu : public Scene {
00106         public:
00107                 Menu();
00108                 virtual ~Menu();
00109 
00110                 bool load(Application *parent);
00111                 bool unload();
00112                 bool update();
00113                 bool drawFrame();
00114 
00115                 void handleChar(char ch);
00116 
00117         protected:
00118 
00119                 bool loadMain();
00120                 bool unloadMain();
00121                 bool loadCreate();
00122                 bool unloadCreate();
00123                 bool loadJoin();
00124                 bool unloadJoin();
00125                 bool loadSettings();
00126                 bool unloadSettings();
00127 
00128                 void menuMainSelect();
00129 
00130                 void drawMain();
00131                 void drawCreate();
00132                 void drawJoin();
00133                 void drawSettings();
00134                 void drawCredits();
00135 
00136                 void drawSelection();
00137                 void drawLabel(TextureID tex, float x, float y);
00138                 void drawSelect(Vec2 pos, float size = 10.0f);
00139 
00140                 void drawQuad(TextureID tex, float x, float y, float w, float h);
00141 
00142                 void updateMain();
00143                 void updateCreate();
00144                 void updateJoin();
00145                 void updateSettings();
00146                 void updateCredits();
00147 
00148                 void setCamera(Vec3 pos, float pitch, float heading, bool soft = false);
00149 
00150                 bool loadModels();
00151                 bool setModel(unsigned int model, const char *file, const char *skin, const char *avatar);
00152 
00153         protected:
00154                 TextureID               m_textures[MENU_TEXTURES];
00155                 TextureID               m_mainTextures[MENU_MAIN_TEXTURES];
00156                 OpenGLObject    *m_objects[MENU_OBJECTS];
00157 
00158                 Sound   m_sounds[MENU_SOUNDS];
00159 
00160                 Vec3    m_vMain[MENU_MAIN_SELECTIONS];
00161                 Vec3    m_vCreate;
00162                 Vec3    m_vJoin;
00163                 Vec3    m_vSettings;
00164                 Vec3    m_vSelection;
00165                 Vec3    m_vSun;
00166 
00167                 SMenuPlanets    m_planets[MENU_PLANETS];
00168                 SLight                  m_lights[MENU_LIGHTS];
00169 
00170                 SMenuInput              m_inputs[MENU_INPUTS];
00171                 int                             m_selected[MENUS];
00172 
00173                 int             m_selection;
00174                 int             m_menu;
00175 
00176                 float   m_camDist;
00177 
00178                 ShaderID        m_shader;
00179 
00180                 OpenGLParticleSystem    m_particleSystem;
00181                 GLuint                                  query;
00182 
00183                 int     m_inview;
00184 
00185                 TextureID       m_texModels[MODELS];
00186                 int m_selModel;
00187 };
00188 
00189 #endif

Generated on Sun Jun 5 15:47:04 2005 for Defacto by  doxygen 1.4.3