mirror of
https://github.com/Oibaf66/frodo-wii.git
synced 2024-11-25 21:14:22 +01:00
Finish the options menu implementation (hooray!)
This commit is contained in:
parent
8aaeee4327
commit
292d107d72
2
Makefile
2
Makefile
@ -13,7 +13,7 @@ widget.oo: widget.cpp widget.hh
|
|||||||
gui.oo: gui.cpp gui.hh Makefile font.hh menu.hh sdl_ttf_font.hh \
|
gui.oo: gui.cpp gui.hh Makefile font.hh menu.hh sdl_ttf_font.hh \
|
||||||
dialogue_box.hh help_box.hh main_menu.cpp disc_menu.cpp \
|
dialogue_box.hh help_box.hh main_menu.cpp disc_menu.cpp \
|
||||||
file_browser.hh timer.hh game_info.hh widget.hh options_menu.cpp \
|
file_browser.hh timer.hh game_info.hh widget.hh options_menu.cpp \
|
||||||
network_menu.cpp mocks/Prefs.h
|
network_menu.cpp mocks/Prefs.h mocks/C64.h
|
||||||
|
|
||||||
virtual_keyboard.oo: virtual_keyboard.hh virtual_keyboard.cpp widget.hh listener.hh
|
virtual_keyboard.oo: virtual_keyboard.hh virtual_keyboard.cpp widget.hh listener.hh
|
||||||
|
|
||||||
|
@ -3,6 +3,10 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#define SPEED_95 30
|
||||||
|
#define SPEED_100 20
|
||||||
|
#define SPEED_110 18
|
||||||
|
|
||||||
class Prefs
|
class Prefs
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -11,11 +15,20 @@ public:
|
|||||||
strcpy(this->NetworkName, "Unset name");
|
strcpy(this->NetworkName, "Unset name");
|
||||||
strcpy(this->NetworkServer, "play.c64-network.org");
|
strcpy(this->NetworkServer, "play.c64-network.org");
|
||||||
this->NetworkPort = 46214;
|
this->NetworkPort = 46214;
|
||||||
|
|
||||||
|
this->Emul1541Proc = 0;
|
||||||
|
this->ShowLEDs = 0;
|
||||||
|
this->DisplayOption = 0;
|
||||||
|
this->MsPerFrame = SPEED_100;
|
||||||
}
|
}
|
||||||
|
|
||||||
char NetworkName[32];
|
char NetworkName[32];
|
||||||
char NetworkServer[128];
|
char NetworkServer[128];
|
||||||
int NetworkPort;
|
int NetworkPort;
|
||||||
|
int Emul1541Proc;
|
||||||
|
int ShowLEDs;
|
||||||
|
int DisplayOption;
|
||||||
|
unsigned int MsPerFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __MOCK_PREFS_HH__ */
|
#endif /* __MOCK_PREFS_HH__ */
|
||||||
|
@ -11,6 +11,7 @@ public:
|
|||||||
OptionsMenu(Font *font, HelpBox *help) : Menu(font)
|
OptionsMenu(Font *font, HelpBox *help) : Menu(font)
|
||||||
{
|
{
|
||||||
this->help = help;
|
this->help = help;
|
||||||
|
this->setText(options_menu_messages);
|
||||||
}
|
}
|
||||||
|
|
||||||
~OptionsMenu()
|
~OptionsMenu()
|
||||||
@ -19,24 +20,9 @@ public:
|
|||||||
|
|
||||||
virtual void selectCallback(int which)
|
virtual void selectCallback(int which)
|
||||||
{
|
{
|
||||||
printf("option entry %d selected: %s\n", which, this->pp_msgs[which]);
|
/* Doesn't matter which, it's just selection */
|
||||||
switch (which)
|
this->updatePrefs();
|
||||||
{
|
Gui::gui->popView();
|
||||||
case 0: /* Insert disc */
|
|
||||||
break;
|
|
||||||
case 2: /* Load/save states */
|
|
||||||
break;
|
|
||||||
case 4: /* Keyboard */
|
|
||||||
break;
|
|
||||||
case 7: /* Reset the C64 */
|
|
||||||
break;
|
|
||||||
case 8: /* Networking */
|
|
||||||
break;
|
|
||||||
case 9: /* Options */
|
|
||||||
break;
|
|
||||||
case 10: /* Help */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void hoverCallback(int which)
|
virtual void hoverCallback(int which)
|
||||||
@ -46,9 +32,52 @@ public:
|
|||||||
|
|
||||||
virtual void escapeCallback(int which)
|
virtual void escapeCallback(int which)
|
||||||
{
|
{
|
||||||
|
this->updatePrefs();
|
||||||
Gui::gui->popView();
|
Gui::gui->popView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void updatePrefs()
|
||||||
|
{
|
||||||
|
Gui::gui->np->Emul1541Proc = !this->p_submenus[1].sel;
|
||||||
|
Gui::gui->np->ShowLEDs = !this->p_submenus[2].sel;
|
||||||
|
Gui::gui->np->DisplayOption = this->p_submenus[3].sel;
|
||||||
|
|
||||||
|
switch (this->p_submenus[4].sel)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
Gui::gui->np->MsPerFrame = SPEED_95; break;
|
||||||
|
case 1:
|
||||||
|
Gui::gui->np->MsPerFrame = SPEED_100; break;
|
||||||
|
case 2:
|
||||||
|
Gui::gui->np->MsPerFrame = SPEED_110; break;
|
||||||
|
default:
|
||||||
|
panic("Impossible submenu value: %d\n", this->p_submenus[4].sel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void updateSubmenus()
|
||||||
|
{
|
||||||
|
int submenu_defs[5];
|
||||||
|
|
||||||
|
submenu_defs[0] = 0;
|
||||||
|
submenu_defs[1] = !Gui::gui->np->Emul1541Proc;
|
||||||
|
submenu_defs[2] = !Gui::gui->np->ShowLEDs;
|
||||||
|
submenu_defs[3] = Gui::gui->np->DisplayOption;
|
||||||
|
|
||||||
|
switch (Gui::gui->np->MsPerFrame)
|
||||||
|
{
|
||||||
|
case SPEED_95:
|
||||||
|
submenu_defs[4] = 0; break;
|
||||||
|
case SPEED_110:
|
||||||
|
submenu_defs[4] = 2; break;
|
||||||
|
default:
|
||||||
|
/* If it has some other value... */
|
||||||
|
submenu_defs[4] = 1; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->setText(options_menu_messages, submenu_defs);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
HelpBox *help;
|
HelpBox *help;
|
||||||
};
|
};
|
||||||
@ -61,7 +90,6 @@ public:
|
|||||||
{
|
{
|
||||||
this->help = new HelpBox(NULL, options_menu_help);
|
this->help = new HelpBox(NULL, options_menu_help);
|
||||||
this->menu = new OptionsMenu(NULL, this->help);
|
this->menu = new OptionsMenu(NULL, this->help);
|
||||||
this->menu->setText(options_menu_messages);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~OptionsView()
|
~OptionsView()
|
||||||
@ -79,6 +107,11 @@ public:
|
|||||||
Gui::gui->bg_submenu_middle, Gui::gui->bg_submenu_right);
|
Gui::gui->bg_submenu_middle, Gui::gui->bg_submenu_right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void viewPushCallback()
|
||||||
|
{
|
||||||
|
this->menu->updateSubmenus();
|
||||||
|
}
|
||||||
|
|
||||||
void runLogic()
|
void runLogic()
|
||||||
{
|
{
|
||||||
this->menu->runLogic();
|
this->menu->runLogic();
|
||||||
|
Loading…
Reference in New Issue
Block a user