00001 #ifndef _VGUI_H
00002 #define _VGUI_H
00003
00004
00005 #include <map>
00006 #include <string>
00007 #include <GL/gl.h>
00008 #include <SDL/SDL.h>
00009 #include "multiplay.h"
00010 #include "textures.h"
00011 #include "font.h"
00012 #include "gamestate.h"
00013 #include "settings.h"
00014 #include "configfile.h"
00015 #include "replay.h"
00016 #include "globals.h"
00017 #include "widget.h"
00018 #include "page.h"
00019
00020 namespace VGUI
00021 {
00022 class Gui
00023 {
00024 private:
00025 TEXTURE_HANDLE mouse_pointer;
00026 map<string, Page*> pages;
00027 string cur_page, last_page;
00028 string menu_path;
00029 bool menu_enabled;
00030 float ptr_w, ptr_h;
00031 int mouse_x, mouse_y;
00032 int mouse_lock_x, mouse_lock_y;
00033 int screen_width, screen_height;
00034 bool l, m, r, u, d;
00035 bool joy_l, joy_r, joy_u, joy_d, joy_positive;
00036 bool key_down, cancel_down;
00037 Uint32 joy_press_time;
00038 Uint32 page_switch_time;
00039 Uint8 last_axis, last_joy;
00040 float joy_axis_value;
00041 bool is_locked, loaded, calibrated;
00042
00043 public:
00044 Gui();
00045 Gui( string path );
00046 ~Gui();
00047 void Init();
00048 void ReInit();
00049 void DeInit();
00050 void Draw();
00051 void KeyPress( SDLKey key );
00052 void KeyRelease( SDLKey key );
00053 void MousePress();
00054 void MouseRelease();
00055 void MouseReturn();
00056 void MouseUpdate();
00057 void JoyPress( Uint8 joy_idx, Uint8 joy_btn );
00058 void JoyRelease( Uint8 joy_idx, Uint8 joy_btn );
00059 void JoyMove( Uint8 joy_idx, Uint8 joy_axis, float val );
00060 void JoyUpdate();
00061 void ChangePage( string page_name );
00062 void ProcessAction( string action );
00063 void UpdateScreenSize();
00064
00065 string GetCurrentPageName() { return cur_page; }
00066 bool GetEnabled() { return menu_enabled; }
00067 Page* GetPage( string page_name ) { return pages[page_name]; }
00068
00069 void SetCurrentPageName( string new_cur_page ) { cur_page = new_cur_page; }
00070 void SetEnabled( bool new_enabled ) { menu_enabled = new_enabled; }
00071
00072 bool GetLocked() { return is_locked; }
00073 void SetLocked( bool new_locked ) { is_locked = new_locked; }
00074 };
00075 }
00076
00077 #endif // _VGUI_H