From db6c63d42449146dd793c03a2c2c42346eaf8311 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 25 Oct 2020 02:51:52 -0500 Subject: [PATCH] Adjusts guiGameListMenuCtrl.cpp to handle Left and Right keys to adjust options, which simultaneously fixes the 'jiggle' issue on the options menu of the BaseGame base UI Per Steve's suggestion, put a pause on gameplay sounds alongside the game sim being paused when the pause menu is opened. Nudges the keybind preview image for guiGameListMenuCtrl to be better centered --- Engine/source/gui/controls/guiGameListMenuCtrl.cpp | 10 +++++++++- Templates/BaseGame/game/data/ui/guis/optionsMenu.gui | 2 +- Templates/BaseGame/game/data/ui/guis/pauseMenu.cs | 2 ++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp index 65c31f952..7f39acf5f 100644 --- a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp +++ b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp @@ -391,7 +391,7 @@ void GuiGameListMenuCtrl::onRenderKeybindOption(Row* row, Point2I currentOffset) //drawer->drawBitmap(row->mBitmap, ) Point2I button; - button.x = currentOffset.x + columnSplit + (columnSplit / 2)/* + (optionWidth / 2)*/; + button.x = currentOffset.x + columnSplit + (columnSplit / 2.5)/* + (optionWidth / 2)*/; button.y = currentOffset.y + (rowHeight / 4); Point2I buttonSize; @@ -885,6 +885,14 @@ bool GuiGameListMenuCtrl::onKeyDown(const GuiEvent &event) changeRow(1); return true; + case KEY_LEFT: + changeOption(-1); + return true; + + case KEY_RIGHT: + changeOption(1); + return true; + case KEY_A: case KEY_RETURN: case KEY_NUMPADENTER: diff --git a/Templates/BaseGame/game/data/ui/guis/optionsMenu.gui b/Templates/BaseGame/game/data/ui/guis/optionsMenu.gui index f289ad018..5d357e9fd 100644 --- a/Templates/BaseGame/game/data/ui/guis/optionsMenu.gui +++ b/Templates/BaseGame/game/data/ui/guis/optionsMenu.gui @@ -206,7 +206,7 @@ willFirstRespond = "1"; hScrollBar = "alwaysOff"; vScrollBar = "dynamic"; - lockHorizScroll = "0"; + lockHorizScroll = "1"; lockVertScroll = "0"; constantThumbHeight = "0"; childMargin = "0 0"; diff --git a/Templates/BaseGame/game/data/ui/guis/pauseMenu.cs b/Templates/BaseGame/game/data/ui/guis/pauseMenu.cs index c59784b48..734a4a682 100644 --- a/Templates/BaseGame/game/data/ui/guis/pauseMenu.cs +++ b/Templates/BaseGame/game/data/ui/guis/pauseMenu.cs @@ -9,6 +9,7 @@ function PauseMenu::onWake(%this) { $timescale = 0; + sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ 0 ] ); PauseMenuList.hidden = false; PauseMenuList.setFirstResponder(); PauseButtonHolder.setActive(); @@ -18,6 +19,7 @@ function PauseMenu::onWake(%this) function PauseMenu::onSleep(%this) { $timescale = 1; + sfxSetChannelVolume( $SimAudioType, $pref::SFX::channelVolume[ $SimAudioType ] ); } function PauseMenu::onReturnTo(%this)