2010-01-25 14:01:22 +01:00
|
|
|
#ifndef __GUI_HH__
|
|
|
|
#define __GUI_HH__
|
|
|
|
|
|
|
|
#include <SDL.h>
|
2010-01-29 07:35:40 +01:00
|
|
|
#include <timer.hh>
|
2010-01-25 14:01:22 +01:00
|
|
|
|
|
|
|
#include "menu.hh"
|
|
|
|
#include "font.hh"
|
|
|
|
#include "gui_view.hh"
|
|
|
|
|
|
|
|
/* Frodo stuff */
|
|
|
|
#include <sysdeps.h>
|
|
|
|
#include <main.h>
|
|
|
|
#include <Prefs.h>
|
|
|
|
|
2013-01-13 19:48:15 +01:00
|
|
|
#if defined(GEKKO)
|
|
|
|
#define THEME_ROOT_PATH "/frodo/themes"
|
|
|
|
#define METADATA_ROOT_PATH "/frodo/metadata"
|
|
|
|
#define GAME_ROOT_PATH "/frodo/images"
|
2013-01-19 23:46:32 +01:00
|
|
|
#define GAME_ROOT_PATH_SD "sd:/"
|
2013-01-13 19:48:15 +01:00
|
|
|
#define GAME_ROOT_PATH_USB "usb:/"
|
|
|
|
#define GAME_ROOT_PATH_SMB "smb:/"
|
|
|
|
#define TMP_ROOT_PATH "/frodo/tmp"
|
|
|
|
#define SAVE_GAME_ROOT_PATH "/frodo/saves"
|
|
|
|
#else
|
|
|
|
#define THEME_ROOT_PATH "themes"
|
|
|
|
#define METADATA_ROOT_PATH "metadata"
|
|
|
|
#define GAME_ROOT_PATH "images"
|
|
|
|
#define TMP_ROOT_PATH "tmp"
|
|
|
|
#define SAVE_GAME_ROOT_PATH "saves"
|
|
|
|
#endif
|
|
|
|
|
2010-01-25 14:01:22 +01:00
|
|
|
class DialogueBox;
|
|
|
|
class StatusBar;
|
2010-02-28 08:59:36 +01:00
|
|
|
class NetworkServerMessages;
|
2010-01-25 14:01:22 +01:00
|
|
|
class GameInfo;
|
|
|
|
|
|
|
|
class MainView;
|
|
|
|
class BindKeysView;
|
|
|
|
class DiscView;
|
|
|
|
class SaveGameView;
|
|
|
|
class OptionsView;
|
|
|
|
class NetworkView;
|
|
|
|
class ThemeView;
|
|
|
|
class GameInfoView;
|
2010-02-11 19:57:08 +01:00
|
|
|
class NetworkUserView;
|
2010-02-21 11:25:39 +01:00
|
|
|
class NetworkRegionView;
|
2010-01-25 14:01:22 +01:00
|
|
|
|
|
|
|
class VirtualKeyboard;
|
|
|
|
|
|
|
|
class Gui
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Gui();
|
|
|
|
|
|
|
|
~Gui();
|
|
|
|
|
|
|
|
bool setTheme(const char *path);
|
|
|
|
|
|
|
|
void activate();
|
|
|
|
|
|
|
|
void runLogic(void);
|
|
|
|
|
2010-03-06 08:25:12 +01:00
|
|
|
void pushJoystickEvent(event_t ev);
|
|
|
|
|
2010-02-21 16:58:28 +01:00
|
|
|
void pushEvent(event_t ev);
|
|
|
|
|
2010-01-25 14:01:22 +01:00
|
|
|
void pushEvent(SDL_Event *ev);
|
|
|
|
|
|
|
|
void draw(SDL_Surface *where);
|
|
|
|
|
|
|
|
void pushView(GuiView *view);
|
|
|
|
|
|
|
|
void pushVirtualKeyboard(VirtualKeyboard *kbd);
|
|
|
|
|
|
|
|
void pushDialogueBox(DialogueBox *dlg);
|
|
|
|
|
|
|
|
DialogueBox *popDialogueBox();
|
|
|
|
|
|
|
|
GuiView *popView();
|
|
|
|
|
|
|
|
GuiView *peekView()
|
|
|
|
{
|
|
|
|
if (!this->views)
|
|
|
|
return NULL;
|
|
|
|
return this->views[this->n_views-1];
|
|
|
|
}
|
|
|
|
|
|
|
|
void updateGameInfo(GameInfo *gi);
|
|
|
|
|
2010-02-24 21:19:37 +01:00
|
|
|
void saveGameInfo(const char *base_path, const char *name);
|
2010-01-25 14:01:22 +01:00
|
|
|
|
|
|
|
void exitMenu();
|
|
|
|
|
|
|
|
/* These are private, keep off! */
|
|
|
|
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, int size);
|
|
|
|
|
|
|
|
bool is_active;
|
|
|
|
Menu *focus; /* Where the focus goes */
|
|
|
|
Menu *main_menu;
|
2010-03-15 07:11:31 +01:00
|
|
|
SDL_Surface *screenshot;
|
2010-01-25 14:01:22 +01:00
|
|
|
|
|
|
|
SDL_Surface *background;
|
|
|
|
SDL_Surface *main_menu_bg;
|
|
|
|
SDL_Surface *status_bar_bg;
|
|
|
|
SDL_Surface *infobox;
|
2010-02-28 09:25:59 +01:00
|
|
|
SDL_Surface *bind_key_box;
|
2010-02-28 09:02:45 +01:00
|
|
|
SDL_Surface *network_message_box;
|
2010-01-30 16:38:19 +01:00
|
|
|
SDL_Surface *keyboard;
|
2010-01-25 14:01:22 +01:00
|
|
|
SDL_Surface *dialogue_bg;
|
|
|
|
SDL_Surface *disc_info;
|
2010-02-23 21:10:45 +01:00
|
|
|
SDL_Surface *network_info;
|
2010-01-25 14:01:22 +01:00
|
|
|
SDL_Surface *bg_left, *bg_right, *bg_middle,
|
|
|
|
*bg_submenu_left, *bg_submenu_right, *bg_submenu_middle;
|
|
|
|
SDL_Surface *highlighted_key;
|
|
|
|
SDL_Surface *selected_key;
|
|
|
|
|
|
|
|
Font *default_font;
|
|
|
|
Font *small_font;
|
2010-08-15 13:59:34 +02:00
|
|
|
TimerController *controller;
|
2010-01-25 14:01:22 +01:00
|
|
|
|
|
|
|
/* Handled specially */
|
|
|
|
VirtualKeyboard *kbd;
|
|
|
|
DialogueBox *dlg;
|
|
|
|
StatusBar *status_bar;
|
2010-02-28 08:59:36 +01:00
|
|
|
NetworkServerMessages *server_msgs;
|
2010-01-25 14:01:22 +01:00
|
|
|
|
|
|
|
MainView *mv;
|
|
|
|
DiscView *dv;
|
|
|
|
SaveGameView *sgv;
|
|
|
|
OptionsView *ov;
|
|
|
|
NetworkView *nv;
|
|
|
|
GameInfoView *giv;
|
|
|
|
ThemeView *tv;
|
|
|
|
BindKeysView *bkv;
|
2010-02-11 19:57:08 +01:00
|
|
|
NetworkUserView *nuv;
|
2010-02-21 11:25:39 +01:00
|
|
|
NetworkRegionView *nrv;
|
2010-01-25 14:01:22 +01:00
|
|
|
|
|
|
|
GuiView **views;
|
|
|
|
int n_views;
|
|
|
|
|
|
|
|
const char *metadata_base_path;
|
|
|
|
const char *theme_base_path;
|
|
|
|
const char *game_base_path;
|
2013-01-19 23:46:32 +01:00
|
|
|
const char *game_base_path_sd;
|
2011-06-05 15:46:38 +02:00
|
|
|
const char *game_base_path_usb;
|
2011-08-08 13:21:52 +02:00
|
|
|
const char *game_base_path_smb;
|
2010-01-25 14:01:22 +01:00
|
|
|
const char *tmp_path;
|
|
|
|
const char *save_game_path;
|
|
|
|
|
|
|
|
GameInfo *cur_gameInfo;
|
|
|
|
bool gameInfoChanged;
|
|
|
|
|
|
|
|
/* New preferences */
|
2010-01-25 15:25:19 +01:00
|
|
|
Prefs cur_prefs;
|
2010-01-25 14:01:22 +01:00
|
|
|
Prefs *np;
|
|
|
|
|
|
|
|
/* Singleton */
|
|
|
|
static void init();
|
|
|
|
static Gui *gui;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* GUI_HH */
|