Skip to content

Commit

Permalink
Tutorial: Added introduction to renderer appearance
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Apr 10, 2014
1 parent ebea0ed commit 653c046
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 4 deletions.
3 changes: 2 additions & 1 deletion doomsday/client/src/ui/dialogs/renderersettingsdialog.cpp
Expand Up @@ -53,7 +53,7 @@ DENG_GUI_PIMPL(RendererSettingsDialog)
ScrollAreaWidget &area = self.area();

area.add(appear = new ProfilePickerWidget(ClientApp::renderSystem().appearanceSettings(),
tr("appearance")));
tr("appearance"), "profile-picker"));
appear->setOpeningDirection(ui::Down);

area.add(fov = new CVarSliderWidget("rend-camera-fov"));
Expand Down Expand Up @@ -122,6 +122,7 @@ RendererSettingsDialog::RendererSettingsDialog(String const &name)
heading().setText(tr("Renderer Settings"));

LabelWidget *appearLabel = LabelWidget::newWithText(tr("Appearance:"), &area());
appearLabel->setName("appearance-label"); // for lookup from tutorial
LabelWidget *fovLabel = LabelWidget::newWithText(tr("Field of View:"), &area());

LabelWidget *precacheLabel = LabelWidget::newWithText(tr("Precaching:"), &area());
Expand Down
63 changes: 60 additions & 3 deletions doomsday/client/src/ui/widgets/tutorialwidget.cpp
Expand Up @@ -26,6 +26,7 @@
#include <de/MessageDialog>
#include <de/SignalAction>
#include <de/Untrapper>
#include <de/PopupMenuWidget>

using namespace de;

Expand All @@ -38,12 +39,12 @@ DENG_GUI_PIMPL(TutorialWidget)
TaskBar,
DEMenu,
ConfigMenus,
RendererAppearance,
ConsoleKey,
Finish
};

Step current;
//LabelWidget *darken;
MessageDialog *dlg;
LabelWidget *highlight;
QTimer flashing;
Expand Down Expand Up @@ -81,7 +82,7 @@ DENG_GUI_PIMPL(TutorialWidget)
void startHighlight(GuiWidget const &w)
{
highlight->rule().setRect(w.rule());
highlight->setOpacity(.2f);
highlight->setOpacity(0);
highlight->show();
flashing.start();
flash();
Expand Down Expand Up @@ -114,15 +115,44 @@ DENG_GUI_PIMPL(TutorialWidget)
win.taskBar().closeConfigMenu();
break;

case RendererAppearance:
win.taskBar().closeConfigMenu();
break;

default:
break;
}
}

/**
* Checks if step @a s is valid for the current engine state and if not,
* skips to the next valid state.
*
* @param s Current step.
*/
void validateStep(Step &s)
{
forever
{
if(!App_GameLoaded())
{
if(s == RendererAppearance)
{
s = Step(s + 1);
continue;
}
}
break;
}
}

void initStep(Step s)
{
deinitStep();

// Jump to the next valid step, if necessary.
validateStep(s);

if(s == Finish)
{
self.stop();
Expand Down Expand Up @@ -198,13 +228,34 @@ DENG_GUI_PIMPL(TutorialWidget)
startHighlight(*root().guiFind("conf-button"));
break;

case RendererAppearance:
dlg->title().setText(tr("Appearance"));
dlg->message().setText(tr("By default Doomsday applies many visual "
"embellishments to how the game world appears. These "
"can be configured individually in the Renderer "
"Appearance editor, or you can use one of the built-in "
"default profiles: %1, %2, or %3.")
.arg(_E(b) "Defaults" _E(.))
.arg(_E(b) "Vanilla" _E(.))
.arg(_E(b) "Amplified" _E(.)));
win.taskBar().openConfigMenu();
win.root().guiFind("conf-menu")->as<PopupMenuWidget>().menu()
.organizer().itemWidget(tr("Renderer"))->as<ButtonWidget>().trigger();
dlg->setAnchorAndOpeningDirection(
win.root().guiFind("renderersettings")->find("appearance-label")
->as<LabelWidget>().rule(), ui::Left);
startHighlight(*root().guiFind("profile-picker"));
break;

case ConsoleKey: {
dlg->title().setText(tr("Console"));
String msg = tr("The console is a \"Quake style\" command line prompt where "
"you enter commands and change variable values. To get started, "
"try typing %1 in the console.").arg(_E(b) "help" _E(.));
if(App_GameLoaded())
{
// Event bindings are currently stored per-game, so we can't set a
// binding unless a game is loaded.
msg += "\n\nBelow you can see the current keyboard shortcut for accessing the console quickly. "
"To change it, click in the box and then press the key or key combination you "
"want to assign as the shortcut.";
Expand All @@ -225,7 +276,13 @@ DENG_GUI_PIMPL(TutorialWidget)
break;
}

self.root().addOnTop(dlg);
GuiRootWidget &root = self.root();

// Keep the tutorial above any dialogs etc. that might've been opened.
root.remove(self);
root.addOnTop(&self);

root.addOnTop(dlg);
dlg->open();
}
};
Expand Down

0 comments on commit 653c046

Please sign in to comment.