C:/Documents and Settings/jegan/Desktop/projectX/Menu.h

Go to the documentation of this file.
00001 #ifndef MENU_H
00002 #define MENU_H
00003 
00004 #include <string>
00005 #include <vector>
00006 #include "SDL.h"
00007 
00008 class Game;
00009 #include "List.h"
00010 class Sprite;
00011 
00012 class Menu
00013 {
00014 public:
00015         Menu();
00016         Menu(std::string filename);
00017         Menu(List * MenuInfo);
00018         void mainLoop();
00019         
00020         void drawTitle(int x, int y, bool selected);
00021         
00022         virtual void draw();
00023 
00024         virtual bool control(SDL_Event event);
00025         
00026         // return true if we're "done" with this menu given the selection made by the user
00027         virtual bool select();
00028 
00029         ~Menu();
00030 protected:
00031         static int _textHeight;
00032         static int _leftMargin;
00033         static int _topMargin;
00034         Sprite * _background;
00035         std::string _title;
00036         std::vector<std::string> _subtitles;
00037         size_t _selected;
00038         size_t _selectedMax;
00039         std::vector<Menu *> _options;
00040 
00041 private:
00042         void load(List * MenuInfo);
00043         
00044         
00045 };
00046 
00047 class SelectKeyMenu: public Menu
00048 {
00049 public:
00050         SelectKeyMenu(List * menuInfo);
00051         void draw();
00052         bool select();
00053 private:
00054         std::string _text[9];
00055         std::string _keys[9];
00056 };
00057 
00058 class NewGameMenu: public Menu
00059 {
00060 public:
00061         NewGameMenu(List * menuInfo);
00062         void draw();
00063         bool select();
00064 private:
00065         Game * _game;
00066         bool _won;
00067         std::vector<std::string> _levelFile;
00068         std::vector<std::string> _levelName;
00069         std::vector<bool> _levelUnLocked;
00070         std::vector<bool> _levelInMenu;
00071         int _totalLevels;
00072 };
00073 
00074 class TitleScreenMenu: public Menu
00075 {
00076 public:
00077         TitleScreenMenu(List * menuInfo);
00078         bool select();
00079         void draw();
00080 };
00081 
00082 #endif

Generated on Fri May 5 00:20:19 2006 for ProjectX by  doxygen 1.4.6-NO