mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-29 15:04:23 +01:00
Simplifiy the implementation of some things (no parent pointer,
all resources in the Gui singleton)
This commit is contained in:
parent
224ec1dbe7
commit
aad20592ec
@ -42,8 +42,8 @@ class DiscMenu : public FileBrowser, TimeoutHandler
|
|||||||
friend class DiscView;
|
friend class DiscView;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DiscMenu(Font *font, GuiView *parent) :
|
DiscMenu(Font *font) :
|
||||||
FileBrowser(game_exts, font, parent), TimeoutHandler()
|
FileBrowser(game_exts, font), TimeoutHandler()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ public:
|
|||||||
{
|
{
|
||||||
printf("Hovering timed out over %s\n",
|
printf("Hovering timed out over %s\n",
|
||||||
this->pp_msgs[this->cur_sel]);
|
this->pp_msgs[this->cur_sel]);
|
||||||
((DiscView*)this->parent)->loadGameInfo(this->pp_msgs[this->cur_sel]);
|
Gui::gui->dv->loadGameInfo(this->pp_msgs[this->cur_sel]);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void escapeCallback(int which)
|
virtual void escapeCallback(int which)
|
||||||
@ -154,7 +154,7 @@ private:
|
|||||||
|
|
||||||
DiscView::DiscView() : GuiView()
|
DiscView::DiscView() : GuiView()
|
||||||
{
|
{
|
||||||
this->menu = new DiscMenu(NULL, this);
|
this->menu = new DiscMenu(NULL);
|
||||||
this->gameInfo = new GameInfoBox(NULL);
|
this->gameInfo = new GameInfoBox(NULL);
|
||||||
|
|
||||||
this->bg = NULL;
|
this->bg = NULL;
|
||||||
|
@ -7,9 +7,8 @@
|
|||||||
class FileBrowser : public Menu
|
class FileBrowser : public Menu
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FileBrowser(const char **exts, Font *font, GuiView *parent) : Menu(font)
|
FileBrowser(const char **exts, Font *font) : Menu(font)
|
||||||
{
|
{
|
||||||
this->parent = parent;
|
|
||||||
this->path = NULL;
|
this->path = NULL;
|
||||||
this->exts = exts;
|
this->exts = exts;
|
||||||
|
|
||||||
@ -50,7 +49,6 @@ protected:
|
|||||||
const char *path;
|
const char *path;
|
||||||
const char **file_list;
|
const char **file_list;
|
||||||
const char **exts;
|
const char **exts;
|
||||||
GuiView *parent;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __FILE_BROWSER_HH__ */
|
#endif /* __FILE_BROWSER_HH__ */
|
||||||
|
@ -37,9 +37,8 @@ class MainMenu : public Menu
|
|||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainMenu(Font *font, HelpBox *help, GuiView *parent) : Menu(font)
|
MainMenu(Font *font, HelpBox *help) : Menu(font)
|
||||||
{
|
{
|
||||||
this->parent = parent;
|
|
||||||
this->help = help;
|
this->help = help;
|
||||||
/* The dialogue box is only present when needed */
|
/* The dialogue box is only present when needed */
|
||||||
this->dialogue = NULL;
|
this->dialogue = NULL;
|
||||||
@ -113,7 +112,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
DialogueBox *dialogue;
|
DialogueBox *dialogue;
|
||||||
GuiView *parent;
|
|
||||||
HelpBox *help;
|
HelpBox *help;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -124,12 +122,8 @@ public:
|
|||||||
MainView() : GuiView()
|
MainView() : GuiView()
|
||||||
{
|
{
|
||||||
this->help = new HelpBox(NULL, main_menu_help);
|
this->help = new HelpBox(NULL, main_menu_help);
|
||||||
this->menu = new MainMenu(NULL, this->help, this);
|
this->menu = new MainMenu(NULL, this->help);
|
||||||
this->menu->setText(main_menu_messages);
|
this->menu->setText(main_menu_messages);
|
||||||
this->bg = NULL;
|
|
||||||
this->infobox = NULL;
|
|
||||||
this->textbox = NULL;
|
|
||||||
this->dialogue_bg = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~MainView()
|
~MainView()
|
||||||
@ -140,11 +134,6 @@ public:
|
|||||||
|
|
||||||
void updateTheme()
|
void updateTheme()
|
||||||
{
|
{
|
||||||
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(Gui::gui->default_font);
|
this->menu->setFont(Gui::gui->default_font);
|
||||||
this->help->setFont(Gui::gui->small_font);
|
this->help->setFont(Gui::gui->small_font);
|
||||||
this->menu->setSelectedBackground(Gui::gui->bg_left, Gui::gui->bg_middle,
|
this->menu->setSelectedBackground(Gui::gui->bg_left, Gui::gui->bg_middle,
|
||||||
@ -168,33 +157,30 @@ public:
|
|||||||
|
|
||||||
/* Blit the backgrounds */
|
/* Blit the backgrounds */
|
||||||
dst = (SDL_Rect){20,45,300,400};
|
dst = (SDL_Rect){20,45,300,400};
|
||||||
SDL_BlitSurface(this->bg, NULL, where, &dst);
|
SDL_BlitSurface(Gui::gui->main_menu_bg, NULL, where, &dst);
|
||||||
|
|
||||||
dst = (SDL_Rect){350,13,0,0};
|
dst = (SDL_Rect){350,13,0,0};
|
||||||
SDL_BlitSurface(this->infobox, NULL, where, &dst);
|
SDL_BlitSurface(Gui::gui->infobox, NULL, where, &dst);
|
||||||
|
|
||||||
dst = (SDL_Rect){350,242,0,0};
|
dst = (SDL_Rect){350,242,0,0};
|
||||||
SDL_BlitSurface(this->textbox, NULL, where, &dst);
|
SDL_BlitSurface(Gui::gui->textbox, NULL, where, &dst);
|
||||||
|
|
||||||
this->menu->draw(where, 50, 70, 300, 400);
|
this->menu->draw(where, 50, 70, 300, 400);
|
||||||
this->help->draw(where, 354, 24, 264, 210);
|
this->help->draw(where, 354, 24, 264, 210);
|
||||||
if (this->menu->dialogue) {
|
if (this->menu->dialogue) {
|
||||||
int d_x = where->w / 2 - this->dialogue_bg->w / 2;
|
int d_x = where->w / 2 - Gui::gui->dialogue_bg->w / 2;
|
||||||
int d_y = where->h / 2 - this->dialogue_bg->h / 2;
|
int d_y = where->h / 2 - Gui::gui->dialogue_bg->h / 2;
|
||||||
|
|
||||||
dst = (SDL_Rect){d_x, d_y, this->dialogue_bg->w, this->dialogue_bg->h};
|
dst = (SDL_Rect){d_x, d_y,
|
||||||
SDL_BlitSurface(this->dialogue_bg, NULL, where, &dst);
|
Gui::gui->dialogue_bg->w, Gui::gui->dialogue_bg->h};
|
||||||
|
SDL_BlitSurface(Gui::gui->dialogue_bg, NULL, where, &dst);
|
||||||
|
|
||||||
this->menu->dialogue->draw(where, d_x + 10, d_y + 10,
|
this->menu->dialogue->draw(where, d_x + 10, d_y + 10,
|
||||||
this->dialogue_bg->w - 10, this->dialogue_bg->h - 10);
|
Gui::gui->dialogue_bg->w - 10, Gui::gui->dialogue_bg->h - 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MainMenu *menu;
|
MainMenu *menu;
|
||||||
HelpBox *help;
|
HelpBox *help;
|
||||||
SDL_Surface *bg;
|
|
||||||
SDL_Surface *infobox;
|
|
||||||
SDL_Surface *textbox;
|
|
||||||
SDL_Surface *dialogue_bg;
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user