Skip to content

Commit

Permalink
Menu: Improvements to the Controls menu; faster drawing
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Sep 23, 2018
1 parent 99394c9 commit 2c15190
Show file tree
Hide file tree
Showing 7 changed files with 197 additions and 171 deletions.
Expand Up @@ -49,6 +49,9 @@ class InputBindingWidget : public Widget

char const *controlName() const;
de::String bindContext() const;

private:
DENG2_PRIVATE(d)
};

} // namespace menu
Expand Down
33 changes: 17 additions & 16 deletions doomsday/apps/plugins/common/src/hu_menu.cpp
Expand Up @@ -737,7 +737,7 @@ void Hu_MenuInitPlayerSetupPage()
void Hu_MenuInitSaveOptionsPage()
{
Page *page = Hu_MenuAddPage(new Page("SaveOptions", Vector2i(60, 50)));
page->setTitle("Save Options");
page->setTitle("Savegame Options");
page->setPredefinedFont(MENU_FONT1, FID(GF_FONTA));
page->setPreviousPage(Hu_MenuPagePtr("Options"));

Expand Down Expand Up @@ -910,17 +910,25 @@ void Hu_MenuInitOptionsPage()
.setAction(Widget::Deactivated, Hu_MenuSelectEndGame)
.setAction(Widget::FocusGained, Hu_MenuDefaultFocusAction);

page->addWidget(new ButtonWidget("Player Setup"))
.setShortcut('p')
.setGroup(1)
.setFont(MENU_FONT1)
.setUserValue(String("PlayerSetup"))
.setAction(Widget::Deactivated, Hu_MenuActionSetActivePage)
.setAction(Widget::FocusGained, Hu_MenuDefaultFocusAction);

page->addWidget(new ButtonWidget("Show Taskbar"))
.setShortcut('t')
.setFont(MENU_FONT1)
.setGroup(1)
.setAction(Widget::Deactivated, Hu_MenuSelectControlPanelLink)
.setAction(Widget::FocusGained, Hu_MenuDefaultFocusAction);

page->addWidget(new ButtonWidget("Multiplayer"))
.setShortcut('m')
page->addWidget(new ButtonWidget("Sound"))
.setShortcut('s')
.setFont(MENU_FONT1)
.setUserValue(String("PlayerSetup"))
.setUserValue(String("SoundOptions"))
.setAction(Widget::Deactivated, Hu_MenuActionSetActivePage)
.setAction(Widget::FocusGained, Hu_MenuDefaultFocusAction);

Expand All @@ -938,13 +946,6 @@ void Hu_MenuInitOptionsPage()
.setAction(Widget::Deactivated, Hu_MenuActionSetActivePage)
.setAction(Widget::FocusGained, Hu_MenuDefaultFocusAction);

page->addWidget(new ButtonWidget("Game saves"))
.setShortcut('s')
.setFont(MENU_FONT1)
.setUserValue(String("SaveOptions"))
.setAction(Widget::Deactivated, Hu_MenuActionSetActivePage)
.setAction(Widget::FocusGained, Hu_MenuDefaultFocusAction);

page->addWidget(new ButtonWidget("HUD"))
.setShortcut('h')
.setFont(MENU_FONT1)
Expand Down Expand Up @@ -975,12 +976,12 @@ void Hu_MenuInitOptionsPage()
.setAction(Widget::FocusGained, Hu_MenuDefaultFocusAction);
#endif

page->addWidget(new ButtonWidget("Sound"))
page->addWidget(new ButtonWidget("Savegame"))
.setShortcut('s')
.setFont(MENU_FONT1)
.setUserValue(String("SoundOptions"))
.setUserValue(String("SaveOptions"))
.setAction(Widget::Deactivated, Hu_MenuActionSetActivePage)
.setAction(Widget::FocusGained, Hu_MenuDefaultFocusAction);
.setAction(Widget::FocusGained, Hu_MenuDefaultFocusAction);
}

void Hu_MenuInitGameplayOptionsPage()
Expand Down Expand Up @@ -1338,8 +1339,8 @@ void Hu_MenuInitHUDOptionsPage()
.setGroup(4);

#if __JDOOM__
page->addWidget(new LabelWidget("Single Key Display")).setLeft();
page->addWidget(new CVarToggleWidget("hud-keys-combine")).setRight();
page->addWidget(new LabelWidget("Single Key Display")).setLeft().setGroup(4);
page->addWidget(new CVarToggleWidget("hud-keys-combine")).setRight().setGroup(4);
#endif

page->addWidget(new LabelWidget("AutoHide Status"))
Expand Down
7 changes: 5 additions & 2 deletions doomsday/apps/plugins/common/src/m_ctrl.cpp
Expand Up @@ -229,6 +229,7 @@ void Hu_MenuActivateBindingsGrab(Widget &, Widget::Action)
void Hu_MenuInitControlsPage()
{
Page *page = Hu_MenuAddPage(new Page("ControlOptions", Vector2i(32, 40), 0, Hu_MenuDrawControlsPage));
page->setLeftColumnWidth(.4f);
page->setTitle("Controls");
page->setPredefinedFont(MENU_FONT1, FID(GF_FONTA));
page->setPreviousPage(Hu_MenuPagePtr("Options"));
Expand All @@ -240,12 +241,12 @@ void Hu_MenuInitControlsPage()
controlconfig_t *binds = &controlConfig[i];

char const *labelText = binds->text;
if(labelText && (PTR2INT(labelText) > 0 && PTR2INT(labelText) < NUMTEXT))
if (labelText && (PTR2INT(labelText) > 0 && PTR2INT(labelText) < NUMTEXT))
{
labelText = GET_TXT(PTR2INT(labelText));
}

if(!binds->command && !binds->controlName)
if (!binds->command && !binds->controlName)
{
// Inert.
page->addWidget(new LabelWidget(labelText))
Expand All @@ -255,10 +256,12 @@ void Hu_MenuInitControlsPage()
else
{
page->addWidget(new LabelWidget(labelText))
.setLeft()
.setGroup(group);

InputBindingWidget *binding = new InputBindingWidget;
binding->binds = binds;
binding->setRight();
binding->setGroup(group);
binding->setAction(Widget::Activated, Hu_MenuActivateBindingsGrab);
binding->setAction(Widget::FocusGained, Hu_MenuDefaultFocusAction);
Expand Down
Expand Up @@ -68,6 +68,7 @@ void ButtonWidget::draw() const
// Vector4f const color = de::lerp(textColor, Vector4f(Vector3f(cfg.common.menuTextFlashColor), textColor.w), t);

const float fadeout = scrollingFadeout();
if (fadeout < .001f) return;

FR_SetFont(fontId);
FR_SetColorAndAlpha(color.x, color.y, color.z, color.w * fadeout);
Expand Down

0 comments on commit 2c15190

Please sign in to comment.