mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2025-02-16 20:39:15 +01:00
Singleton refactoring, part 2
This commit is contained in:
parent
337921d2ab
commit
eeb03b75e4
6
gui.cpp
6
gui.cpp
@ -31,6 +31,10 @@ static const char *get_theme_path(const char *dir, const char *what)
|
||||
/* These are a bit of special cases... */
|
||||
#include "main_menu.cpp"
|
||||
|
||||
GuiView::GuiView()
|
||||
{
|
||||
}
|
||||
|
||||
Gui::Gui()
|
||||
{
|
||||
this->focus = NULL;
|
||||
@ -53,7 +57,7 @@ Gui::Gui()
|
||||
this->views = NULL;
|
||||
|
||||
/* Create the views */
|
||||
MainView *mv = new MainView(this);
|
||||
MainView *mv = new MainView();
|
||||
this->pushView(mv);
|
||||
}
|
||||
|
||||
|
7
gui.hh
7
gui.hh
@ -11,10 +11,7 @@ class Gui;
|
||||
class GuiView
|
||||
{
|
||||
public:
|
||||
GuiView(Gui *parent)
|
||||
{
|
||||
this->parent = parent;
|
||||
}
|
||||
GuiView();
|
||||
|
||||
virtual void pushEvent(SDL_Event *ev) = 0;
|
||||
|
||||
@ -23,8 +20,6 @@ public:
|
||||
virtual void updateTheme() = 0;
|
||||
|
||||
virtual void draw(SDL_Surface *where) = 0;
|
||||
|
||||
Gui *parent;
|
||||
};
|
||||
|
||||
class Gui
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
|
||||
virtual void escapeCallback(int which)
|
||||
{
|
||||
this->parent->parent->exitMenu();
|
||||
Gui::gui->exitMenu();
|
||||
}
|
||||
|
||||
private:
|
||||
@ -99,7 +99,7 @@ private:
|
||||
class MainView : public GuiView
|
||||
{
|
||||
public:
|
||||
MainView(Gui *parent) : GuiView(parent)
|
||||
MainView() : GuiView()
|
||||
{
|
||||
this->help = new HelpBox(NULL, main_menu_help);
|
||||
this->menu = new MainMenu(NULL, this->help, this);
|
||||
@ -118,16 +118,16 @@ public:
|
||||
|
||||
void updateTheme()
|
||||
{
|
||||
this->bg = parent->main_menu_bg;
|
||||
this->infobox = parent->infobox;
|
||||
this->textbox = parent->textbox;
|
||||
this->dialogue_bg = parent->dialogue_bg;
|
||||
this->bg = Gui::gui->main_menu_bg;
|
||||
this->infobox = Gui::gui->infobox;
|
||||
this->textbox = Gui::gui->textbox;
|
||||
this->dialogue_bg = Gui::gui->dialogue_bg;
|
||||
|
||||
this->menu->setFont(this->parent->default_font);
|
||||
this->help->setFont(this->parent->small_font);
|
||||
this->menu->setSelectedBackground(this->parent->bg_left, this->parent->bg_middle,
|
||||
this->parent->bg_right, this->parent->bg_submenu_left,
|
||||
this->parent->bg_submenu_middle, this->parent->bg_submenu_right);
|
||||
this->menu->setFont(Gui::gui->default_font);
|
||||
this->help->setFont(Gui::gui->small_font);
|
||||
this->menu->setSelectedBackground(Gui::gui->bg_left, Gui::gui->bg_middle,
|
||||
Gui::gui->bg_right, Gui::gui->bg_submenu_left,
|
||||
Gui::gui->bg_submenu_middle, Gui::gui->bg_submenu_right);
|
||||
}
|
||||
|
||||
void runLogic()
|
||||
|
Loading…
x
Reference in New Issue
Block a user