Roguelike
 All Classes Namespaces Functions Variables Typedefs Friends Pages
gui.h
1 
20 #ifndef _GUI_H
21 #define _GUI_H
22 
23 #define FONTDIR DATADIR "/font/"
24 
25 #include <SDL/SDL.h>
26 #include <boost/date_time/gregorian/gregorian.hpp>
27 #include <boost/date_time/posix_time/posix_time.hpp>
28 
29 #include <chunk.h>
30 #include <virtual_event.h>
31 #include <game.h>
32 #include <defs.h>
33 #include <world_map.h>
34 #include <world_map_gui.h>
35 #include <color_def.h>
36 #include <menu.h>
37 #include <game_states.h>
38 #include <stdio.h>
39 #include <fstream>
40 #include <debug.h>
41 
42 namespace pt = boost::posix_time;
43 class GUI : public VirtualEvent {
44 
45 
46  typedef std::vector<std::vector<Tile*> > TilePointerMatrix;
47  typedef std::vector<std::vector<Tile> > TileMatrix;
48  private:
49  void load_font(string);
50 
51  static const long STD_MS_PER_FRAME = 70;
52 
53  pt::ptime game_clock;
54 
55  bool running;
56  std::vector<std::string> messages;
57  std::string input;
58 
59  DebugConsole debug;
60  KeyState keyset;
61  Screen current_screen;
62  Screen last_screen;
63  WorldMapGUI world_map_gui;
64  Menu* menu;
65  Game game;
66 
67  SDL_Event event;
68  SDL_Surface* screen;
69  SDL_Surface* asciiBase;
70  SDL_Surface* ascii;
71 
72  int handle_framerate();
73  void clear_screen();
74  void render_canvas();
75  void render_enemies();
76  void render_character();
77  void render_interface();
78  void render_menu(Menu* menu);
79  void render_debug();
80  void render_target();
81  void render_animations();
82  void clear_area(IntPoint start, IntPoint size);
83  int render_stats(Character* chara, int height);
84  public:
85  GUI();
86  ~GUI();
87  int OnExecute();
88  void OnRender();
89  void OnLoop();
90  void OnCleanup();
91  bool OnInit();
92 
93  void OnEvent(SDL_Event* Event);
94  void OnKeyDown(SDLKey sym, SDLMod mod, Uint16 unicode);
95  void OnExit();
96 
97  void perform_action_press(SDLKey);
98  void perform_action_cont();
99 
106  void add_key_input(SDLKey key, Uint16 unicode);
107 };
108 
109 #endif
void OnEvent(SDL_Event *Event)
Definition: gui_event.cpp:30
Definition: character.h:42
void OnRender()
Definition: gui_render.cpp:23
void add_key_input(SDLKey key, Uint16 unicode)
Definition: gui_event.cpp:275
Definition: debug.h:66
Definition: gui.h:43
Definition: virtual_event.h:25
Definition: game.h:49
void perform_action_press(SDLKey)
Definition: gui_event.cpp:102
Definition: int_point.h:26
void OnLoop()
Definition: gui_loop.cpp:23
Definition: menu.h:44
bool OnInit()
Definition: gui_init.cpp:25
Definition: world_map_gui.h:37
GUI()
Definition: gui.cpp:25
void OnCleanup()
Definition: gui_cleanup.cpp:22