MainMenuState.h

Go to the documentation of this file.
00001 /* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 5 -*- */
00002 
00003 /*
00004  * Combination of a first person action and a real time strategy battle game.
00005  */
00006 
00007 /*
00008  * MainMenuState.h
00009  * MetalWarriors
00010  * $Revision: 1.25 $
00011  *
00012  * Created by Daniel Aarno on Sun Oct 12 2003.
00013  * Copyright (c) 2003 Daniel Aarno and Erik Ytterberg - All rights reserved.
00014  *
00015  *     This program is free software; you can redistribute it and/or modify
00016  *     it under the terms of the GNU General Public License as published by
00017  *     the Free Software Foundation; either version 2 of the License, or
00018  *     (at your option) any later version.
00019  *
00020  *     This program is distributed in the hope that it will be useful,
00021  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  *     GNU General Public License for more details.
00024  *
00025  *     You should have received a copy of the GNU General Public License
00026  *     along with this program; if not, write to the Free Software
00027  *     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00028  */
00029 
00030 #include <list>
00031 #include <stack>
00032 #include "aedGUI/include/aedGui.h"
00033 #include <SDL/SDL_image.h>
00034 #include "State.h"
00035 #include "MWTheme.h"
00036 #include "aedOverlay.h"
00037 
00038 
00039 #define O_SET 10
00040 
00041 class MainMenuState : public State
00042 {
00043 protected:
00044   int window_x, window_y;
00045   
00046   std::stack<class GuiMenu*> menu_stack;
00047   std::list<class GuiMenu*> menu_list;
00048   
00049   SDL_Surface *bg;
00050   
00051   SDL_Surface *menuTex;
00052   uint menuTexId;
00053   class GuiMenu *currentMenu;
00054   
00055   static bool exit_menu_state;
00056   
00057   std::vector<std::string> mission_names;
00058   std::vector<aedButton*> mission_buttons;
00059   int currentMission;
00060   int missionColumns;
00061   int missionRows;
00062   int missionStartColumn;
00063   
00064 public:
00065   MainMenuState(StateID state);
00066   virtual ~MainMenuState();
00067   virtual void paint();
00068   virtual void doKey(int key, int x, int y, bool special,
00069                bool down, unsigned int modifiers);
00070   class GuiMenu *getCurrentMenu(void) {return currentMenu;}
00071   void SwitchGuiMenu(void *caller, void *dummy);
00072   void SwitchBackGuiMenu(void *caller, void *dummy);
00073   void StartGame(void *caller, void *dummy);
00074   class GuiMenu *OptionUnsupported(void);
00075   void AddMenu(class GuiMenu* menu){menu_list.push_back(menu);}
00076   void setResolution(int width, int height);
00077   void updateMissionMenu(void);
00078   void shiftMissionMenu(bool up);
00079   void selectMission(aedButton *caller);
00080      void autoStart();
00081      void autoStartCheck();
00082   std::string getMissionName(void) {return mission_names[currentMission];}
00083 };
00084 
00085 class GuiMenu
00086 {
00087 public:
00088   char *title;
00089   aedOverlay *olay;
00090   aedWidget *menu_bottom;
00091   aedButton *back_button;
00092   aedWidget *frame;
00093   static int MenuMaxX, MenuMaxY;
00094   
00095   GuiMenu(char *title_, int width, int height, MainMenuState *state);
00096   ~GuiMenu();
00097   aedWidget *GetBottom(void){return menu_bottom;}
00098   void ConnectGuiMenu(aedButton *invoker,
00099                 class GuiMenu *from,
00100                 bool connect_back_button = true);
00101   
00102 };
00103 
00104 
00105 /*Hooks*/
00106 void SwitchGuiMenuHook(void *caller, void *dummy);
00107 void SwitchBackGuiMenuHook(void *caller, void *dummy);
00108 void StartGameHook(void *caller, void *dummy);
00109 void StartNetworkHook(void *caller, void *dummy);
00110 void StartHostHook(void *caller, void *dummy);
00111 void vidModeChanged(void *caller, void *data);
00112 void toggleFullScreen(void *caller, void *data);
00113 int FindMissions(std::vector<std::string> &dirents);
00114 void ShiftMissionMenuUpHook(void *caller, void *dummy);
00115 void ShiftMissionMenuDownHook(void *caller, void *dummy);
00116 void SelectMissionHook(void *caller, void *dummy);
00117 void SetTextureCompressionPref(void *caller, void *dummy);
00118 void SetVertexBufferPref(void *caller, void *dummy);

Generated on Sun Mar 11 15:33:23 2007 for MetalWarriors by  doxygen 1.4.7