2009-11-28 08:22:19 +00:00
|
|
|
#ifndef __GUI_HH__
|
|
|
|
#define __GUI_HH__
|
|
|
|
|
|
|
|
#include <SDL.h>
|
|
|
|
|
|
|
|
#include "menu.hh"
|
|
|
|
#include "font.hh"
|
2009-12-16 17:47:03 +00:00
|
|
|
#include "timer.hh"
|
2009-12-20 09:31:46 +00:00
|
|
|
#include "gui_view.hh"
|
2009-11-28 08:22:19 +00:00
|
|
|
|
2010-01-01 09:30:05 +00:00
|
|
|
/* Frodo stuff */
|
|
|
|
#include <Prefs.h>
|
|
|
|
|
2009-12-31 13:25:46 +00:00
|
|
|
class DialogueBox;
|
2010-01-16 09:08:54 +00:00
|
|
|
class StatusBar;
|
2010-01-16 14:08:39 +00:00
|
|
|
class GameInfo;
|
2010-01-05 15:23:19 +00:00
|
|
|
|
|
|
|
class MainView;
|
2010-01-06 16:42:55 +00:00
|
|
|
class BindKeysView;
|
2009-12-13 10:02:27 +00:00
|
|
|
class DiscView;
|
2009-12-28 12:38:41 +00:00
|
|
|
class OptionsView;
|
2009-12-29 13:23:01 +00:00
|
|
|
class NetworkView;
|
2010-01-05 15:23:19 +00:00
|
|
|
class ThemeView;
|
2010-01-16 14:08:39 +00:00
|
|
|
class GameInfoView;
|
2010-01-05 15:23:19 +00:00
|
|
|
|
2009-12-20 10:12:47 +00:00
|
|
|
class VirtualKeyboard;
|
2009-11-28 08:22:19 +00:00
|
|
|
|
|
|
|
class Gui
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Gui();
|
|
|
|
|
|
|
|
~Gui();
|
|
|
|
|
|
|
|
bool setTheme(const char *path);
|
|
|
|
|
2009-11-28 08:43:37 +00:00
|
|
|
void activate();
|
2009-11-28 08:22:19 +00:00
|
|
|
|
2009-11-28 08:43:37 +00:00
|
|
|
void deActivate();
|
2009-11-28 08:22:19 +00:00
|
|
|
|
|
|
|
void runLogic(void);
|
|
|
|
|
|
|
|
void pushEvent(SDL_Event *ev);
|
|
|
|
|
|
|
|
void draw(SDL_Surface *where);
|
|
|
|
|
2009-12-04 20:45:17 +00:00
|
|
|
void pushView(GuiView *view);
|
|
|
|
|
2010-01-02 12:28:18 +00:00
|
|
|
void pushVirtualKeyboard(VirtualKeyboard *kbd);
|
|
|
|
|
2009-12-31 13:25:46 +00:00
|
|
|
void pushDialogueBox(DialogueBox *dlg);
|
|
|
|
|
|
|
|
DialogueBox *popDialogueBox();
|
|
|
|
|
2009-12-04 20:45:17 +00:00
|
|
|
GuiView *popView();
|
|
|
|
|
2009-12-05 09:33:58 +00:00
|
|
|
GuiView *peekView()
|
|
|
|
{
|
|
|
|
if (!this->views)
|
|
|
|
return NULL;
|
|
|
|
return this->views[this->n_views-1];
|
|
|
|
}
|
|
|
|
|
2010-01-16 14:08:39 +00:00
|
|
|
void updateGameInfo(GameInfo *gi);
|
|
|
|
|
2010-01-23 14:47:01 +00:00
|
|
|
void saveGameInfo();
|
|
|
|
|
2009-12-05 09:33:58 +00:00
|
|
|
void exitMenu();
|
2009-11-29 18:29:15 +00:00
|
|
|
|
|
|
|
/* These are private, keep off! */
|
2009-11-28 08:22:19 +00:00
|
|
|
const char *getThemePath(const char *dir, const char *what);
|
|
|
|
|
|
|
|
SDL_Surface *loadThemeImage(const char *dir, const char *what);
|
|
|
|
|
2009-12-04 20:06:52 +00:00
|
|
|
Font *loadThemeFont(const char *dir, const char *what, int size);
|
2009-11-28 08:22:19 +00:00
|
|
|
|
|
|
|
bool is_active;
|
|
|
|
Menu *focus; /* Where the focus goes */
|
|
|
|
Menu *main_menu;
|
|
|
|
|
2009-11-28 08:59:42 +00:00
|
|
|
SDL_Surface *background;
|
|
|
|
SDL_Surface *main_menu_bg;
|
2010-01-16 09:08:54 +00:00
|
|
|
SDL_Surface *status_bar_bg;
|
2009-12-04 17:55:25 +00:00
|
|
|
SDL_Surface *infobox;
|
|
|
|
SDL_Surface *textbox;
|
2009-12-05 12:04:00 +00:00
|
|
|
SDL_Surface *dialogue_bg;
|
2009-12-13 10:10:33 +00:00
|
|
|
SDL_Surface *disc_info;
|
2009-11-28 08:22:19 +00:00
|
|
|
SDL_Surface *bg_left, *bg_right, *bg_middle,
|
|
|
|
*bg_submenu_left, *bg_submenu_right, *bg_submenu_middle;
|
2009-12-20 10:12:47 +00:00
|
|
|
SDL_Surface *highlighted_key;
|
|
|
|
SDL_Surface *selected_key;
|
2009-11-28 08:22:19 +00:00
|
|
|
|
2009-11-29 18:29:15 +00:00
|
|
|
Font *default_font;
|
2009-12-04 20:06:52 +00:00
|
|
|
Font *small_font;
|
2009-12-16 17:47:03 +00:00
|
|
|
TimerController *timerController;
|
2009-11-29 18:29:15 +00:00
|
|
|
|
2010-01-02 12:28:18 +00:00
|
|
|
/* Handled specially */
|
|
|
|
VirtualKeyboard *kbd;
|
2009-12-31 13:25:46 +00:00
|
|
|
DialogueBox *dlg;
|
2010-01-16 09:08:54 +00:00
|
|
|
StatusBar *status_bar;
|
2009-12-31 13:25:46 +00:00
|
|
|
|
2009-12-13 10:02:27 +00:00
|
|
|
MainView *mv;
|
|
|
|
DiscView *dv;
|
2009-12-28 12:38:41 +00:00
|
|
|
OptionsView *ov;
|
2009-12-29 13:23:01 +00:00
|
|
|
NetworkView *nv;
|
2010-01-16 14:08:39 +00:00
|
|
|
GameInfoView *giv;
|
2010-01-05 15:23:19 +00:00
|
|
|
ThemeView *tv;
|
2010-01-06 16:42:55 +00:00
|
|
|
BindKeysView *bkv;
|
2010-01-05 15:23:19 +00:00
|
|
|
|
2009-11-29 18:29:15 +00:00
|
|
|
GuiView **views;
|
|
|
|
int n_views;
|
2009-12-13 08:54:25 +00:00
|
|
|
|
2009-12-19 13:20:15 +00:00
|
|
|
const char *metadata_base_path;
|
|
|
|
const char *theme_base_path;
|
|
|
|
const char *game_base_path;
|
2009-12-13 08:54:25 +00:00
|
|
|
|
2010-01-16 14:08:39 +00:00
|
|
|
GameInfo *cur_gameInfo;
|
2010-01-23 14:47:01 +00:00
|
|
|
bool gameInfoChanged;
|
2010-01-16 14:08:39 +00:00
|
|
|
|
2010-01-01 09:30:05 +00:00
|
|
|
/* New preferences */
|
|
|
|
Prefs *np;
|
|
|
|
|
2009-12-13 08:54:25 +00:00
|
|
|
/* Singleton */
|
|
|
|
static void init();
|
|
|
|
static Gui *gui;
|
2009-11-28 08:22:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* GUI_HH */
|