add R77 help dialog

This commit is contained in:
thrust26 2019-05-05 00:05:28 +02:00
parent 7ab5847350
commit f4f8bb435d
8 changed files with 87 additions and 21 deletions

View File

@ -19,6 +19,7 @@
#include "Dialog.hxx"
#include "Widget.hxx"
#include "Font.hxx"
#include "HelpDialog.hxx"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -120,12 +121,12 @@ void HelpDialog::updateStrings(uInt8 page, uInt8 lines, string& title)
case 2:
title = "Special commands";
ADD_BIND("Ctrl g", "Grab mouse (keep in window)");
ADD_BIND("Ctrl f", "Switch between NTSC/PAL/SECAM");
ADD_BIND("Ctrl s", "Save game properties to a");
ADD_BIND("", " new file");
ADD_BIND("Alt p", "Toggle 'phosphor' effect");
ADD_BIND("Ctrl p", "Switch palette");
ADD_LINE();
ADD_BIND("Ctrl 0", "Toggle controller for Mouse");
ADD_BIND("Ctrl g", "Grab mouse (keep in window)");
ADD_BIND("Ctrl 0", "Toggle controller for mouse");
ADD_BIND("Ctrl 1", "Toggle Stelladaptor left/right");
break;

View File

@ -97,10 +97,10 @@ MinUICommandDialog::MinUICommandDialog(OSystem& osystem, DialogContainer& parent
wid.push_back(myStretchButton);
myPhosphorButton = ADD_CD_BUTTON("", kPhosphorCmd);
wid.push_back(myPhosphorButton);
bw = ADD_CD_BUTTON("Settings"+ ELLIPSIS, kSettings);
wid.push_back(bw);
bw = ADD_CD_BUTTON("Fry", kFry);
wid.push_back(bw);
bw = ADD_CD_BUTTON("Settings" + ELLIPSIS, kSettings);
wid.push_back(bw);
// Bottom row
xoffset = HBORDER + (buttonWidth + HGAP) / 2;
@ -185,7 +185,7 @@ void MinUICommandDialog::handleCommand(CommandSender* sender, int cmd,
consoleCmd = true;
break;
// Column 2
// Column 2
case kSaveStateCmd:
event = Event::SaveState;
consoleCmd = true;
@ -217,11 +217,7 @@ void MinUICommandDialog::handleCommand(CommandSender* sender, int cmd,
updateWinds();
break;
case GuiObject::kCloseCmd:
instance().eventHandler().leaveMenuMode();
break;
// Column 3
// Column 3
case kFormatCmd:
instance().console().toggleFormat();
updateTVFormat();
@ -237,13 +233,18 @@ void MinUICommandDialog::handleCommand(CommandSender* sender, int cmd,
instance().console().togglePhosphor();
break;
case kFry:
instance().eventHandler().leaveMenuMode();
instance().console().fry();
break;
case kSettings:
openSettings();
break;
case kFry:
// Bottom row
case GuiObject::kCloseCmd:
instance().eventHandler().leaveMenuMode();
instance().console().fry();
break;
case kExitGameCmd:
@ -316,3 +317,4 @@ void MinUICommandDialog::openSettings()
myOptionsDialog->open();
}
}

View File

@ -70,7 +70,7 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
if (minSettings)
{
ButtonWidget* bw = new ButtonWidget(this, _font, xoffset, yoffset,
_w - HBORDER * 2, buttonHeight, "Switch to Basic Settings" + ELLIPSIS, kBasSetCmd);
_w - HBORDER * 2, buttonHeight, "Use Basic Settings", kBasSetCmd);
wid.push_back(bw);
yoffset += rowHeight + GAP * 2;
_h += rowHeight + GAP * 2;

View File

@ -23,6 +23,14 @@
#include "NTSCFilter.hxx"
#include "PopUpWidget.hxx"
#include "MessageBox.hxx"
// FIXME - use the R77 define in the final release
// use the '1' define for testing
#if defined(RETRON77)
// #if 1
#include "R77HelpDialog.hxx"
#else
#include "HelpDialog.hxx"
#endif
#include "StellaSettingsDialog.hxx"
@ -30,16 +38,19 @@
StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h, Menu::AppMode mode)
: Dialog(osystem, parent, font, "Basic settings"),
myMode(mode)
myMode(mode),
myHelpDialog(nullptr)
{
const int VBORDER = 8;
const int HBORDER = 10;
const int INDENT = 20;
const int buttonHeight = font.getLineHeight() + 6,
lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth();
fontWidth = font.getMaxCharWidth(),
buttonWidth = _font.getStringWidth("Help" + ELLIPSIS) + 32;
const int VGAP = 5;
int xpos, ypos;
ButtonWidget* bw = nullptr;
WidgetArray wid;
VariantList items;
@ -50,9 +61,13 @@ StellaSettingsDialog::StellaSettingsDialog(OSystem& osystem, DialogContainer& pa
xpos = HBORDER;
ypos = VBORDER + _th;
myAdvancedSettings = new ButtonWidget(this, font, xpos, ypos, _w - HBORDER * 2, buttonHeight,
"Switch to Advanced Settings" + ELLIPSIS, kAdvancedSettings);
wid.push_back(myAdvancedSettings);
bw = new ButtonWidget(this, font, xpos, ypos, _w - HBORDER * 2 - buttonWidth - 8, buttonHeight,
"Use Advanced Settings" + ELLIPSIS, kAdvancedSettings);
wid.push_back(bw);
bw = new ButtonWidget(this, font, bw->getRight() + 8, ypos, buttonWidth, buttonHeight,
"Help" + ELLIPSIS, kHelp);
wid.push_back(bw);
ypos += lineHeight + VGAP*4;
new StaticTextWidget(this, font, xpos, ypos + 1, "Global settings:");
@ -338,6 +353,10 @@ void StellaSettingsDialog::handleCommand(CommandSender* sender, int cmd,
instance().eventHandler().leaveMenuMode();
break;
case kHelp:
openHelp();
break;
case kScanlinesChanged:
if(myTVScanIntense->getValue() == 0)
myTVScanIntense->setValueLabel("Off");
@ -481,3 +500,19 @@ int StellaSettingsDialog::valueToLevel(int value)
}
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void StellaSettingsDialog::openHelp()
{
// Create an help dialog, similar to the in-game one
// FIXME - use the R77 define in the final release
// use the '1' define for testing
if (myHelpDialog == nullptr)
#if defined(RETRON77)
// #if 1
myHelpDialog = make_unique<R77HelpDialog>(instance(), parent(), _font);
#else
myHelpDialog = make_unique<HelpDialog>(instance(), parent(), _font);
#endif
myHelpDialog->open();
}

View File

@ -19,6 +19,14 @@
#define STELLA_OPTIONS_DIALOG_HXX
class PopUpWidget;
// FIXME - use the R77 define in the final release
// use the '1' define for testing
#if defined(RETRON77)
// #if 1
class R77HelpDialog;
#else
class HelpDialog;
#endif
#include "Props.hxx"
#include "Menu.hxx"
@ -57,6 +65,8 @@ class StellaSettingsDialog : public Dialog
int levelToValue(int level);
int valueToLevel(int value);
void openHelp();
private:
// advanced settings mode:
ButtonWidget* myAdvancedSettings;
@ -86,6 +96,14 @@ class StellaSettingsDialog : public Dialog
StaticTextWidget* myRightPortDetected;
unique_ptr<GUI::MessageBox> myConfirmMsg;
// FIXME - use the R77 define in the final release
// use the '1' define for testing
#if defined(RETRON77)
// #if 1
unique_ptr<R77HelpDialog> myHelpDialog;
#else
unique_ptr<HelpDialog> myHelpDialog;
#endif
// Indicates if this dialog is used for global (vs. in-game) settings
Menu::AppMode myMode;
@ -93,6 +111,7 @@ class StellaSettingsDialog : public Dialog
enum {
kAdvancedSettings = 'SSad',
kConfirmSwitchCmd = 'SScf',
kHelp = 'SShl',
kScanlinesChanged = 'SSsc',
kPhosphorChanged = 'SSph'
};

View File

@ -35,6 +35,7 @@ MODULE_OBJS := \
src/gui/OptionsDialog.o \
src/gui/PopUpWidget.o \
src/gui/ProgressDialog.o \
src/gui/R77HelpDialog.o \
src/gui/RadioButtonWidget.o \
src/gui/RomAuditDialog.o \
src/gui/RomInfoWidget.o \

View File

@ -504,6 +504,7 @@
<ClCompile Include="..\gui\JoystickDialog.cxx" />
<ClCompile Include="..\gui\LoggerDialog.cxx" />
<ClCompile Include="..\gui\MinUICommandDialog.cxx" />
<ClCompile Include="..\gui\R77HelpDialog.cxx" />
<ClCompile Include="..\gui\RadioButtonWidget.cxx" />
<ClCompile Include="..\gui\SnapshotDialog.cxx" />
<ClCompile Include="..\gui\StellaSettingsDialog.cxx" />
@ -1228,6 +1229,7 @@
<ClInclude Include="..\gui\JoystickDialog.hxx" />
<ClInclude Include="..\gui\LoggerDialog.hxx" />
<ClInclude Include="..\gui\MinUICommandDialog.hxx" />
<ClInclude Include="..\gui\R77HelpDialog.hxx" />
<ClInclude Include="..\gui\RadioButtonWidget.hxx" />
<ClInclude Include="..\gui\SnapshotDialog.hxx" />
<ClInclude Include="..\gui\StellaSettingsDialog.hxx" />
@ -1405,4 +1407,4 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>

View File

@ -972,6 +972,9 @@
<ClCompile Include="..\common\Logger.cxx">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\gui\R77HelpDialog.cxx">
<Filter>Source Files\gui</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\common\bspf.hxx">
@ -1988,6 +1991,9 @@
<ClInclude Include="..\common\Rect.hxx">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\gui\R77HelpDialog.hxx">
<Filter>Header Files\gui</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="stella.ico">