2009-11-28 09:22:19 +01:00
|
|
|
#ifndef __GUI_HH__
|
|
|
|
#define __GUI_HH__
|
|
|
|
|
|
|
|
#include <SDL.h>
|
|
|
|
|
|
|
|
#include "menu.hh"
|
|
|
|
#include "font.hh"
|
2009-12-16 18:47:03 +01:00
|
|
|
#include "timer.hh"
|
2009-11-28 09:22:19 +01:00
|
|
|
|
2009-11-29 19:29:15 +01:00
|
|
|
class Gui;
|
2009-12-13 11:02:27 +01:00
|
|
|
class MainView;
|
|
|
|
class DiscView;
|
2009-11-29 19:29:15 +01:00
|
|
|
|
|
|
|
class GuiView
|
2009-11-28 09:22:19 +01:00
|
|
|
{
|
2009-11-29 19:29:15 +01:00
|
|
|
public:
|
2009-12-13 09:59:06 +01:00
|
|
|
GuiView();
|
2009-11-29 19:29:15 +01:00
|
|
|
|
|
|
|
virtual void pushEvent(SDL_Event *ev) = 0;
|
|
|
|
|
|
|
|
virtual void runLogic() = 0;
|
|
|
|
|
|
|
|
virtual void updateTheme() = 0;
|
|
|
|
|
|
|
|
virtual void draw(SDL_Surface *where) = 0;
|
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-12-04 21:45:17 +01:00
|
|
|
void pushView(GuiView *view);
|
|
|
|
|
|
|
|
GuiView *popView();
|
|
|
|
|
2009-12-05 10:33:58 +01:00
|
|
|
GuiView *peekView()
|
|
|
|
{
|
|
|
|
if (!this->views)
|
|
|
|
return NULL;
|
|
|
|
return this->views[this->n_views-1];
|
|
|
|
}
|
|
|
|
|
|
|
|
void exitMenu();
|
2009-11-29 19:29:15 +01:00
|
|
|
|
|
|
|
/* 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);
|
|
|
|
|
2009-12-04 21:06:52 +01:00
|
|
|
Font *loadThemeFont(const char *dir, const char *what, int size);
|
2009-11-28 09:22:19 +01:00
|
|
|
|
|
|
|
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-12-05 13:04:00 +01:00
|
|
|
SDL_Surface *dialogue_bg;
|
2009-12-13 11:10:33 +01:00
|
|
|
SDL_Surface *disc_info;
|
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;
|
2009-12-04 21:06:52 +01:00
|
|
|
Font *small_font;
|
2009-12-16 18:47:03 +01:00
|
|
|
TimerController *timerController;
|
2009-11-29 19:29:15 +01:00
|
|
|
|
2009-12-13 11:02:27 +01:00
|
|
|
MainView *mv;
|
|
|
|
DiscView *dv;
|
2009-11-29 19:29:15 +01:00
|
|
|
GuiView **views;
|
|
|
|
int n_views;
|
2009-12-13 09:54:25 +01:00
|
|
|
|
2009-12-19 14:20:15 +01:00
|
|
|
const char *metadata_base_path;
|
|
|
|
const char *theme_base_path;
|
|
|
|
const char *game_base_path;
|
2009-12-13 09:54:25 +01:00
|
|
|
|
|
|
|
/* Singleton */
|
|
|
|
static void init();
|
|
|
|
static Gui *gui;
|
2009-11-28 09:22:19 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* GUI_HH */
|