2009-12-13 11:02:27 +01:00
|
|
|
#include "menu.hh"
|
2009-12-15 19:37:34 +01:00
|
|
|
#include "file_browser.hh"
|
|
|
|
|
|
|
|
static const char *game_exts[] = {".d64", ".D64", ".t64", ".T64",
|
|
|
|
".prg",".PRG", ".p00", ".P00", NULL};
|
2009-12-13 11:02:27 +01:00
|
|
|
|
|
|
|
class DiscView;
|
2009-12-15 19:37:34 +01:00
|
|
|
class DiscMenu : public FileBrowser
|
2009-12-13 11:02:27 +01:00
|
|
|
{
|
|
|
|
friend class DiscView;
|
|
|
|
|
|
|
|
public:
|
2009-12-15 19:37:34 +01:00
|
|
|
DiscMenu(Font *font, GuiView *parent) :
|
|
|
|
FileBrowser(game_exts, font, parent)
|
2009-12-13 11:02:27 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
~DiscMenu()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void selectCallback(int which)
|
|
|
|
{
|
|
|
|
printf("entry %d selected: %s\n", which, this->pp_msgs[which]);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void hoverCallback(int which)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void escapeCallback(int which)
|
|
|
|
{
|
|
|
|
Gui::gui->exitMenu();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class DiscView : public GuiView
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DiscView() : GuiView()
|
|
|
|
{
|
|
|
|
this->menu = new DiscMenu(NULL, this);
|
|
|
|
|
|
|
|
this->bg = NULL;
|
|
|
|
this->infobox = NULL;
|
2009-12-13 11:10:33 +01:00
|
|
|
this->disc_info = NULL;
|
2009-12-13 11:02:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
~DiscView()
|
|
|
|
{
|
|
|
|
delete this->menu;
|
|
|
|
}
|
|
|
|
|
|
|
|
void setDirectory(const char *path)
|
|
|
|
{
|
|
|
|
this->menu->setDirectory(path);
|
|
|
|
}
|
|
|
|
|
|
|
|
void updateTheme()
|
|
|
|
{
|
|
|
|
this->bg = Gui::gui->main_menu_bg;
|
|
|
|
this->infobox = Gui::gui->infobox;
|
2009-12-13 11:10:33 +01:00
|
|
|
this->disc_info = Gui::gui->disc_info;
|
2009-12-13 11:02:27 +01:00
|
|
|
|
|
|
|
this->menu->setFont(Gui::gui->default_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()
|
|
|
|
{
|
|
|
|
this->menu->runLogic();
|
|
|
|
}
|
|
|
|
|
|
|
|
void pushEvent(SDL_Event *ev)
|
|
|
|
{
|
|
|
|
this->menu->pushEvent(ev);
|
|
|
|
}
|
|
|
|
|
|
|
|
void draw(SDL_Surface *where)
|
|
|
|
{
|
|
|
|
SDL_Rect dst;
|
|
|
|
|
|
|
|
/* Blit the backgrounds */
|
|
|
|
dst = (SDL_Rect){20,45,300,400};
|
|
|
|
SDL_BlitSurface(this->bg, NULL, where, &dst);
|
|
|
|
|
|
|
|
dst = (SDL_Rect){350,13,0,0};
|
2009-12-13 11:10:33 +01:00
|
|
|
SDL_BlitSurface(this->disc_info, NULL, where, &dst);
|
2009-12-13 11:02:27 +01:00
|
|
|
|
|
|
|
this->menu->draw(where, 50, 70, 300, 400);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
DiscMenu *menu;
|
|
|
|
SDL_Surface *bg;
|
|
|
|
SDL_Surface *infobox;
|
2009-12-13 11:10:33 +01:00
|
|
|
SDL_Surface *disc_info;
|
2009-12-13 11:02:27 +01:00
|
|
|
};
|