2009-11-28 09:22:19 +01:00
|
|
|
#ifndef __GUI_HH__
|
|
|
|
#define __GUI_HH__
|
|
|
|
|
|
|
|
#include <SDL.h>
|
|
|
|
|
|
|
|
#include "menu.hh"
|
|
|
|
#include "font.hh"
|
|
|
|
|
2009-11-29 19:29:15 +01:00
|
|
|
class Gui;
|
|
|
|
|
|
|
|
class GuiView
|
2009-11-28 09:22:19 +01:00
|
|
|
{
|
2009-11-29 19:29:15 +01:00
|
|
|
public:
|
|
|
|
GuiView(Gui *parent)
|
|
|
|
{
|
|
|
|
this->parent = parent;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void pushEvent(SDL_Event *ev) = 0;
|
|
|
|
|
|
|
|
virtual void runLogic() = 0;
|
|
|
|
|
|
|
|
virtual void updateTheme() = 0;
|
|
|
|
|
|
|
|
virtual void draw(SDL_Surface *where) = 0;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
Gui *parent;
|
2009-11-28 09:22:19 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class Gui
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Gui();
|
|
|
|
|
|
|
|
~Gui();
|
|
|
|
|
|
|
|
bool setTheme(const char *path);
|
|
|
|
|
2009-11-28 09:43:37 +01:00
|
|
|
void activate();
|
2009-11-28 09:22:19 +01:00
|
|
|
|
2009-11-28 09:43:37 +01:00
|
|
|
void deActivate();
|
2009-11-28 09:22:19 +01:00
|
|
|
|
|
|
|
void runLogic(void);
|
|
|
|
|
|
|
|
void pushEvent(SDL_Event *ev);
|
|
|
|
|
|
|
|
void draw(SDL_Surface *where);
|
|
|
|
|
2009-11-29 19:29:15 +01:00
|
|
|
void registerView(GuiView *view);
|
|
|
|
|
|
|
|
/* These are private, keep off! */
|
2009-11-28 09:22:19 +01:00
|
|
|
const char *getThemePath(const char *dir, const char *what);
|
|
|
|
|
|
|
|
SDL_Surface *loadThemeImage(const char *dir, const char *what);
|
|
|
|
|
|
|
|
Font *loadThemeFont(const char *dir, const char *what);
|
|
|
|
|
|
|
|
bool is_active;
|
|
|
|
Menu *focus; /* Where the focus goes */
|
|
|
|
Menu *main_menu;
|
|
|
|
|
2009-11-28 09:59:42 +01:00
|
|
|
SDL_Surface *background;
|
|
|
|
SDL_Surface *main_menu_bg;
|
2009-12-04 18:55:25 +01:00
|
|
|
SDL_Surface *infobox;
|
|
|
|
SDL_Surface *textbox;
|
2009-11-28 09:22:19 +01:00
|
|
|
SDL_Surface *bg_left, *bg_right, *bg_middle,
|
|
|
|
*bg_submenu_left, *bg_submenu_right, *bg_submenu_middle;
|
|
|
|
|
2009-11-29 19:29:15 +01:00
|
|
|
Font *default_font;
|
|
|
|
|
|
|
|
GuiView **views;
|
|
|
|
GuiView *cur_view;
|
|
|
|
int n_views;
|
2009-11-28 09:22:19 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* GUI_HH */
|