diff --git a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp index 78599a41f..fff0d4aee 100644 --- a/Engine/source/gui/controls/guiGameListMenuCtrl.cpp +++ b/Engine/source/gui/controls/guiGameListMenuCtrl.cpp @@ -818,6 +818,8 @@ bool GuiGameListMenuCtrl::onInputEvent(const InputEventInfo& event) { bool isModifier = false; + bool state = event.action == SI_MAKE ? 1 : 0; + switch (event.objInst) { case KEY_LCONTROL: @@ -837,12 +839,12 @@ bool GuiGameListMenuCtrl::onInputEvent(const InputEventInfo& event) if (!ActionMap::getKeyString(event.objInst, keyString)) return false; - onInputEvent_callback(deviceString, keyString, event.action); + onInputEvent_callback(deviceString, keyString, state); } else { const char* actionString = ActionMap::buildActionString(&event); - onInputEvent_callback(deviceString, actionString, event.action); + onInputEvent_callback(deviceString, actionString, state); } } else if (event.objType == SI_AXIS || event.objType == SI_INT || event.objType == SI_FLOAT) diff --git a/Templates/BaseGame/game/data/ExampleModule/scripts/default.keybinds.cs b/Templates/BaseGame/game/data/ExampleModule/scripts/default.keybinds.cs index 3f8d6a767..d7637c184 100644 --- a/Templates/BaseGame/game/data/ExampleModule/scripts/default.keybinds.cs +++ b/Templates/BaseGame/game/data/ExampleModule/scripts/default.keybinds.cs @@ -97,7 +97,16 @@ ExampleMoveMap.bind(keyboard, "ctrl h", hideHUDs); ExampleMoveMap.bind(keyboard, "alt p", doScreenShotHudless); -ExampleMoveMap.bindCmd(keyboard, "escape", "", "disconnect();"); +function openPauseMenu(%val) +{ + if(%val && PauseMenu.isAwake() == false) + { + echo("PUSHING PAUSE MENU"); + Canvas.pushDialog(PauseMenu); + } +} + +ExampleMoveMap.bind(keyboard, "escape", openPauseMenu); //------------------------------------------------------------------------------ // Movement Keys @@ -127,7 +136,7 @@ ExampleMoveMap.bind( gamepad, thumbly, "D", "-0.23 0.23", gamePadMoveY ); ExampleMoveMap.bind( gamepad, btn_a, jump ); ExampleMoveMap.bind( gamepad, btn_x, moveup ); ExampleMoveMap.bind( gamepad, btn_y, movedown ); -ExampleMoveMap.bindCmd( gamepad, btn_back, "disconnect();", "" ); +ExampleMoveMap.bindCmd( gamepad, btn_back, "Canvas.pushDialog(PauseMenu);", "" ); //------------------------------------------------------------------------------ // Misc. diff --git a/Templates/BaseGame/game/data/ui/UI.cs b/Templates/BaseGame/game/data/ui/UI.cs index 70a3ae8f3..964a51791 100644 --- a/Templates/BaseGame/game/data/ui/UI.cs +++ b/Templates/BaseGame/game/data/ui/UI.cs @@ -36,8 +36,7 @@ function UI::initClient(%this) exec("./scripts/profiles.cs"); //Now gui files - exec("./guis/guiGamepadButton.cs"); - exec("./guis/guiGamepadButton.gui"); + exec("./scripts/menuInputButtons.cs"); exec("./guis/mainMenu.cs"); exec("./guis/mainMenu.gui"); @@ -80,7 +79,6 @@ function UI::initClient(%this) exec("./scripts/help.cs"); exec("./scripts/cursors.cs"); exec("./scripts/utility.cs"); - exec("./scripts/default.keybinds.cs"); exec("./guis/menuGraphics.gui"); exec("./guis/menuGraphics.cs"); diff --git a/Templates/BaseGame/game/data/ui/guis/chooseLevelDlg.cs b/Templates/BaseGame/game/data/ui/guis/chooseLevelDlg.cs index 3eea5c1f0..9054ee183 100644 --- a/Templates/BaseGame/game/data/ui/guis/chooseLevelDlg.cs +++ b/Templates/BaseGame/game/data/ui/guis/chooseLevelDlg.cs @@ -139,23 +139,14 @@ function ChooseLevelDlg::onWake( %this ) %preview.levelDesc = %desc; }*/ + + ChooseLevelButtonHolder.setActive(); } function ChooseLevelButtonHolder::onWake(%this) { - %this.refresh(); -} - -function ChooseLevelButtonHolder::refresh(%this) -{ - ChooseLevelButtonHolder.add(GamepadButtonsGui); - - GamepadButtonsGui.clearButtons(); - - GamepadButtonsGui.setButton(2, "A", "Enter", "Start Level", "ChooseLevelDlg.beginLevel();"); - GamepadButtonsGui.setButton(3, "B", "Esc", "Back", "ChooseLevelDlg.backOut();"); - - GamepadButtonsGui.refreshButtons(); + %this-->goButton.set("A", "Enter", "Start Level", "ChooseLevelDlg.beginLevel();"); + %this-->backButton.set("B", "Esc", "Back", "ChooseLevelDlg.backOut();"); } function ChooseLevelDlg::onSleep( %this ) diff --git a/Templates/BaseGame/game/data/ui/guis/chooseLevelDlg.gui b/Templates/BaseGame/game/data/ui/guis/chooseLevelDlg.gui index 2a4211acd..9b4771717 100644 --- a/Templates/BaseGame/game/data/ui/guis/chooseLevelDlg.gui +++ b/Templates/BaseGame/game/data/ui/guis/chooseLevelDlg.gui @@ -32,8 +32,28 @@ canSave = "1"; canSaveDynamicFields = "0"; + new GuiBitmapBarCtrl() { + percent = "100"; + vertical = "0"; + flipClip = "0"; + bitmap = "data/ui/images/panel.png"; + color = "255 255 255 255"; + position = "0 0"; + extent = "927 40"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; new GuiTextCtrl(LevelSelectTitle) { - text = "CHOOSE LEVEL"; + text = "SINGLE PLAYER"; maxLength = "1024"; margin = "0 0 0 0"; padding = "0 0 0 0"; @@ -55,6 +75,26 @@ canSave = "1"; canSaveDynamicFields = "0"; }; + new GuiBitmapBarCtrl() { + percent = "100"; + vertical = "0"; + flipClip = "0"; + bitmap = "data/ui/images/panel_low.png"; + color = "255 255 255 255"; + position = "0 40"; + extent = "927 618"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; new GuiBitmapCtrl() { bitmap = "data/ui/images/no-preview"; color = "255 255 255 255"; @@ -76,7 +116,7 @@ Enabled = "1"; }; new GuiTextCtrl() { - text = "EmptyLevel"; + text = "Example Level"; maxLength = "255"; margin = "0 0 0 0"; padding = "0 0 0 0"; @@ -177,7 +217,7 @@ debugRender = "0"; callbackOnInputs = "1"; position = "1 1"; - extent = "450 580"; + extent = "450 90"; minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; @@ -194,8 +234,8 @@ }; }; new GuiControl(ChooseLevelButtonHolder) { - position = "189 652"; - extent = "646 130"; + position = "189 711"; + extent = "646 40"; minExtent = "8 2"; horizSizing = "center"; vertSizing = "top"; @@ -205,8 +245,70 @@ tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "1"; + class = "MenuInputButtonContainer"; canSave = "1"; canSaveDynamicFields = "0"; + + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "./"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Go"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "363 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "MainMenuButtonList.activateRow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "goButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "./"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Back"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "507 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "MainMenuButtonList.activateRow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "backButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; }; }; //--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/ui/guis/guiGamepadButton.gui b/Templates/BaseGame/game/data/ui/guis/guiGamepadButton.gui deleted file mode 100644 index c8313d618..000000000 --- a/Templates/BaseGame/game/data/ui/guis/guiGamepadButton.gui +++ /dev/null @@ -1,239 +0,0 @@ -//--- OBJECT WRITE BEGIN --- -new GuiControl(GamepadButtonsGuiCtrl) { - position = "0 0"; - extent = "646 130"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GamepadDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "1"; - - new GuiDynamicCtrlArrayControl(GamepadButtonsGui) { - position = "0 0"; - extent = "640 100"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GamepadDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "1"; - colSize = "155"; - rowSize = "45"; - rowSpacing = 5; - colSpacing = 5; - frozen = true; - - /*new GuiBitmapCtrl(ButtonBImg) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "GamepadDefaultProfile"; - HorizSizing = "left"; - VertSizing = "relative"; - position = "416 16"; - Extent = "32 32"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - bitmap = "data/ui/images/Inputs/Xbox/Xbox_B"; - wrap = "0"; - }; - new GuiTextCtrl(ButtonBLabel) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "GamepadButtonTextRight"; - HorizSizing = "relative"; - VertSizing = "relative"; - position = "248 16"; - Extent = "160 32"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - text = "Button B Label"; - maxLength = "1024"; - }; - new GuiButtonBaseCtrl(ButtonBButton) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "GamepadDefaultProfile"; - HorizSizing = "relative"; - VertSizing = "relative"; - position = "248 16"; - Extent = "200 32"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - text = "Button"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - }; - new GuiBitmapCtrl(ButtonAImg) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "GamepadDefaultProfile"; - HorizSizing = "left"; - VertSizing = "relative"; - position = "400 64"; - Extent = "32 32"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - bitmap = "data/ui/images/Inputs/Xbox/Xbox_A"; - wrap = "0"; - }; - new GuiTextCtrl(ButtonALabel) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "GamepadButtonTextRight"; - HorizSizing = "relative"; - VertSizing = "relative"; - position = "232 64"; - Extent = "160 32"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - text = "Button B Label"; - maxLength = "1024"; - }; - new GuiButtonBaseCtrl(ButtonAButton) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "GamepadDefaultProfile"; - HorizSizing = "relative"; - VertSizing = "relative"; - position = "232 64"; - Extent = "200 32"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - text = "Button"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - }; - new GuiBitmapCtrl(ButtonXImg) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "GamepadDefaultProfile"; - HorizSizing = "right"; - VertSizing = "relative"; - position = "32 64"; - Extent = "32 32"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - bitmap = "data/ui/images/Inputs/Xbox/Xbox_X"; - wrap = "0"; - }; - new GuiTextCtrl(ButtonXLabel) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "GamepadButtonTextLeft"; - HorizSizing = "relative"; - VertSizing = "relative"; - position = "72 64"; - Extent = "160 32"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - text = "Button X Label"; - maxLength = "1024"; - }; - new GuiButtonBaseCtrl(ButtonXButton) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "GamepadDefaultProfile"; - HorizSizing = "relative"; - VertSizing = "relative"; - position = "32 64"; - Extent = "200 32"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - text = "Button"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - }; - new GuiBitmapCtrl(ButtonYImg) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "GamepadDefaultProfile"; - HorizSizing = "right"; - VertSizing = "relative"; - position = "16 16"; - Extent = "32 32"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - bitmap = "data/ui/images/Inputs/Xbox/Xbox_Y"; - wrap = "0"; - }; - new GuiTextCtrl(ButtonYLabel) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "GamepadButtonTextLeft"; - HorizSizing = "relative"; - VertSizing = "relative"; - position = "55 16"; - Extent = "164 32"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - text = "Button Y Label"; - maxLength = "1024"; - }; - new GuiButtonBaseCtrl(ButtonYButton) { - canSaveDynamicFields = "0"; - Enabled = "1"; - isContainer = "0"; - Profile = "GamepadDefaultProfile"; - HorizSizing = "relative"; - VertSizing = "relative"; - position = "16 16"; - Extent = "208 32"; - MinExtent = "8 2"; - canSave = "1"; - Visible = "1"; - hovertime = "1000"; - text = "Button"; - groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; - };*/ - }; -}; -//--- OBJECT WRITE END --- \ No newline at end of file diff --git a/Templates/BaseGame/game/data/ui/guis/joinServerMenu.cs b/Templates/BaseGame/game/data/ui/guis/joinServerMenu.cs index ec83813bc..467fa4e6d 100644 --- a/Templates/BaseGame/game/data/ui/guis/joinServerMenu.cs +++ b/Templates/BaseGame/game/data/ui/guis/joinServerMenu.cs @@ -4,26 +4,17 @@ function JoinServerMenu::onWake() // Double check the status. Tried setting this the control // inactive to start with, but that didn't seem to work. JoinServerJoinBtn.setActive(JS_serverList.rowCount() > 0); + + JoinServerButtonHolder.setActive(); } function JoinServerButtonHolder::onWake(%this) { - %this.refresh(); -} - -function JoinServerButtonHolder::refresh(%this) -{ - JoinServerButtonHolder.add(GamepadButtonsGui); - - GamepadButtonsGui.clearButtons(); - - GamepadButtonsGui.setButton(1, "A", "", "Query LAN", "JoinServerMenu.queryLan();"); - GamepadButtonsGui.setButton(2, "X", "", "Query Internet", "JoinServerMenu.query();"); - GamepadButtonsGui.setButton(3, "B", "", "Refresh", "JoinServerMenu.refresh();"); - GamepadButtonsGui.setButton(6, "Start", "Enter", "Join", "JoinServerMenu.join();"); - GamepadButtonsGui.setButton(7, "B", "Esc", "Back", "JoinServerMenu.backOut();"); - - GamepadButtonsGui.refreshButtons(); + %this-->joinButton.set("Start", "Enter", "Join", "JoinServerMenu.join();"); + %this-->backButton.set("B", "Esc", "Back", "JoinServerMenu.backOut();"); + %this-->refreshButton.set("Y", "R", "Refresh", "JoinServerMenu.refresh();"); + %this-->queryLANButton.set("A", "Q", "Query LAN", "JoinServerMenu.queryLan();"); + %this-->queryInternetButton.set("X", "E", "Query Internet", "JoinServerMenu.query();"); } //---------------------------------------- diff --git a/Templates/BaseGame/game/data/ui/guis/joinServerMenu.gui b/Templates/BaseGame/game/data/ui/guis/joinServerMenu.gui index 23f02d05a..f58644b7a 100644 --- a/Templates/BaseGame/game/data/ui/guis/joinServerMenu.gui +++ b/Templates/BaseGame/game/data/ui/guis/joinServerMenu.gui @@ -13,9 +13,10 @@ isContainer = "1"; canSave = "1"; canSaveDynamicFields = "1"; + returnGui = "MainMenuGui"; new GuiControl(JoinServerWindow) { - position = "45 56"; + position = "48 56"; extent = "928 655"; minExtent = "8 2"; horizSizing = "center"; @@ -29,14 +30,16 @@ canSave = "1"; canSaveDynamicFields = "0"; - new GuiBitmapCtrl() { - bitmap = "data/ui/images/hudfill.png"; + new GuiBitmapBarCtrl() { + percent = "100"; + vertical = "0"; + flipClip = "0"; + bitmap = "data/ui/images/panel.png"; color = "255 255 255 255"; - wrap = "0"; position = "0 0"; - extent = "928 655"; + extent = "927 40"; minExtent = "8 2"; - horizSizing = "right"; + horizSizing = "width"; vertSizing = "bottom"; profile = "GuiDefaultProfile"; visible = "1"; @@ -70,6 +73,26 @@ canSave = "1"; canSaveDynamicFields = "0"; }; + new GuiBitmapBarCtrl() { + percent = "100"; + vertical = "0"; + flipClip = "0"; + bitmap = "data/ui/images/panel_low.png"; + color = "255 255 255 255"; + position = "0 40"; + extent = "927 618"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; new GuiTextCtrl() { text = "Player Name:"; maxLength = "255"; @@ -99,6 +122,7 @@ sinkAllKeyEvents = "0"; password = "0"; passwordMask = "*"; + text = "Visitor"; maxLength = "255"; margin = "0 0 0 0"; padding = "0 0 0 0"; @@ -111,7 +135,7 @@ minExtent = "8 8"; horizSizing = "right"; vertSizing = "bottom"; - profile = "GuiTextEditProfile"; + profile = "GuiMenuTextEditProfile"; visible = "1"; active = "1"; variable = "$pref::Player::Name"; @@ -294,7 +318,7 @@ clipColumnText = "0"; rowHeightPadding = "2"; position = "1 1"; - extent = "765 8"; + extent = "888 8"; minExtent = "8 8"; horizSizing = "right"; vertSizing = "bottom"; @@ -498,7 +522,7 @@ canSaveDynamicFields = "0"; }; }; - new GuiControl(JoinServerButtonHolder) { + new GuiControl() { position = "189 652"; extent = "646 130"; minExtent = "8 2"; @@ -513,5 +537,174 @@ canSave = "1"; canSaveDynamicFields = "0"; }; + new GuiControl(JoinServerButtonHolder) { + position = "109 711"; + extent = "791 40"; + minExtent = "8 2"; + horizSizing = "center"; + vertSizing = "top"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + class = "MenuInputButtonContainer"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Join"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "507 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "OptionsMenu.apply();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "joinButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Esc"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Back"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "651 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "OptionsMenu.backOut();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "backButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Prev Tab"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "0 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "0"; + active = "0"; + command = "OptionsMenu.prevTab();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "queryLANButton"; + class = "MenuInputButton"; + hidden = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Esc"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Next Tab"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "144 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "0"; + active = "0"; + command = "OptionsMenu.nextTab();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "queryInternetButton"; + class = "MenuInputButton"; + hidden = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_R"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Reset"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "325 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "OptionsMenu.resetToDefaults();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "refreshButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; }; //--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/ui/guis/loadingGui.gui b/Templates/BaseGame/game/data/ui/guis/loadingGui.gui index e907dd193..b0af3e66e 100644 --- a/Templates/BaseGame/game/data/ui/guis/loadingGui.gui +++ b/Templates/BaseGame/game/data/ui/guis/loadingGui.gui @@ -4,7 +4,7 @@ useVariable = "0"; tile = "0"; position = "0 0"; - extent = "1600 838"; + extent = "1024 768"; minExtent = "8 8"; horizSizing = "width"; vertSizing = "height"; @@ -19,7 +19,7 @@ Enabled = "1"; new GuiControl() { - position = "391 429"; + position = "263 301"; extent = "497 166"; minExtent = "8 8"; horizSizing = "center"; @@ -35,8 +35,27 @@ canSave = "1"; canSaveDynamicFields = "0"; + new GuiBitmapCtrl() { + bitmap = "data/ui/images/panel.png"; + color = "255 255 255 255"; + wrap = "0"; + position = "0 0"; + extent = "497 166"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; new GuiBitmapCtrl(LoadingLogo) { - bitmap = "data/ui/images/Torque-3D-logo.png"; + bitmap = "data/ui/images/Torque-3D-logo_alt.png"; + color = "255 255 255 255"; wrap = "0"; position = "27 6"; extent = "443 139"; diff --git a/Templates/BaseGame/game/data/ui/guis/mainMenu.cs b/Templates/BaseGame/game/data/ui/guis/mainMenu.cs index 2f0e914aa..471bf2632 100644 --- a/Templates/BaseGame/game/data/ui/guis/mainMenu.cs +++ b/Templates/BaseGame/game/data/ui/guis/mainMenu.cs @@ -1,32 +1,22 @@ function MainMenuGui::onAdd(%this) { - GamepadButtonsGui.initMenuButtons(); + $activeControllerName = "K&M"; //default input type } function MainMenuGui::onWake(%this) { MainMenuButtonList.hidden = false; + MainMenuButtonHolder.setActive(); } function MainMenuGui::onSleep(%this) { + MainMenuButtonHolder.hidden = true; } function MainMenuButtonHolder::onWake(%this) { - %this.refresh(); -} - -function MainMenuButtonHolder::refresh(%this) -{ - %this.add(GamepadButtonsGui); - - GamepadButtonsGui.clearButtons(); - - //GamepadButtonsGui.setButton(2, "A", "Select", "Go", "echo(\"FART\");"); - //GamepadButtonsGui.setButton(3, "B", "Esc", "Back", ""); - - GamepadButtonsGui.refreshButtons(); + %this-->goButton.set("A", "Enter", "Go", "MainMenuButtonList.activateRow();"); } function MainMenuButtonList::onAdd(%this) @@ -40,24 +30,13 @@ function MainMenuButtonList::onAdd(%this) MainMenuButtonList.addRow("Exit Game", "quit", 8, -15); } -function UIMenuButtonList::onInputEvent(%this, %device, %action, %state) -{ - if(%state) - GamepadButtonsGui.processInputs(%device, %action); -} - -function UIMenuButtonList::onAxisEvent(%this, %device, %action, %axisVal) -{ - GamepadButtonsGui.processAxisEvent(%device, %action); -} - function openSinglePlayerMenu() { $pref::HostMultiPlayer=false; Canvas.pushDialog(ChooseLevelDlg); ChooseLevelDlg.returnGui = MainMenuGui; MainMenuButtonList.hidden = true; - MainMenuAppLogo.setBitmap("data/ui/images/Torque-3D-logo"); + MainMenuButtonHolder.hidden = true; } function openMultiPlayerMenu() @@ -66,7 +45,6 @@ function openMultiPlayerMenu() Canvas.pushDialog(ChooseLevelDlg); ChooseLevelDlg.returnGui = MainMenuGui; MainMenuButtonList.hidden = true; - MainMenuAppLogo.setBitmap("data/ui/images/Torque-3D-logo"); } function openJoinServerMenu() @@ -81,7 +59,6 @@ function openOptionsMenu() Canvas.pushDialog(OptionsMenu); OptionsMenu.returnGui = MainMenuGui; MainMenuButtonList.hidden = true; - MainMenuAppLogo.setBitmap("data/ui/images/Torque-3D-logo"); } function openWorldEditorBtn() @@ -97,5 +74,6 @@ function openGUIEditorBtn() function MainMenuGui::onReturnTo(%this) { MainMenuButtonList.hidden = false; - MainMenuAppLogo.setBitmap("data/ui/images/Torque-3D-logo-shortcut"); + MainMenuButtonList.setFirstResponder(); + MainMenuButtonHolder.setActive(); } \ No newline at end of file diff --git a/Templates/BaseGame/game/data/ui/guis/mainMenu.gui b/Templates/BaseGame/game/data/ui/guis/mainMenu.gui index faa21691b..28466b04f 100644 --- a/Templates/BaseGame/game/data/ui/guis/mainMenu.gui +++ b/Templates/BaseGame/game/data/ui/guis/mainMenu.gui @@ -21,17 +21,15 @@ exec( "tools/gui/profiles.ed.cs" ); Enabled = "1"; isDecoy = "0"; navigationIndex = "-1"; - - new GuiBitmapButtonCtrl(MainMenuAppLogo) { - bitmap = "data/ui/images/Torque-3D-logo"; + + new GuiBitmapCtrl(MainMenuAppLogo) { + bitmap = "data/ui/images/Torque-3D-logo_alt.png"; bitmapMode = "Stretched"; autoFitExtents = "0"; useModifiers = "0"; useStates = "1"; masked = "0"; groupNum = "-1"; - buttonType = "PushButton"; - useMouseEvents = "0"; position = "550 30"; extent = "443 139"; minExtent = "8 2"; @@ -40,7 +38,6 @@ exec( "tools/gui/profiles.ed.cs" ); profile = "GuiDefaultProfile"; visible = "1"; active = "1"; - command = "gotoWebPage(\"forums.torque3d.org\");"; tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "0"; @@ -48,10 +45,9 @@ exec( "tools/gui/profiles.ed.cs" ); canSaveDynamicFields = "1"; navigationIndex = "-1"; }; + new GuiGameListMenuCtrl(MainMenuButtonList) { - class = "UIMenuButtonList"; debugRender = "0"; - callbackOnA = "MainMenuButtonList.activateRow();"; callbackOnInputs = "1"; position = "292 103"; extent = "439 561"; @@ -64,12 +60,13 @@ exec( "tools/gui/profiles.ed.cs" ); tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "0"; + class = "UIMenuButtonList"; canSave = "1"; canSaveDynamicFields = "0"; }; new GuiControl(MainMenuButtonHolder) { - position = "190 652"; - extent = "646 130"; + position = "189 711"; + extent = "646 40"; minExtent = "8 2"; horizSizing = "center"; vertSizing = "top"; @@ -79,8 +76,40 @@ exec( "tools/gui/profiles.ed.cs" ); tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "1"; + class = "MenuInputButtonContainer"; canSave = "1"; canSaveDynamicFields = "0"; + + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Go"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "507 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "MainMenuButtonList.activateRow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "goButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; }; }; //--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/ui/guis/messageBoxDlg.gui b/Templates/BaseGame/game/data/ui/guis/messageBoxDlg.gui index 2565aed58..4516b7dd8 100644 --- a/Templates/BaseGame/game/data/ui/guis/messageBoxDlg.gui +++ b/Templates/BaseGame/game/data/ui/guis/messageBoxDlg.gui @@ -30,15 +30,17 @@ canSave = "1"; canSaveDynamicFields = "0"; - new GuiBitmapCtrl() { - bitmap = "data/ui/images/hudfill.png"; + new GuiBitmapBarCtrl() { + percent = "100"; + vertical = "0"; + flipClip = "0"; + bitmap = "data/ui/images/panel.png"; color = "255 255 255 255"; - wrap = "0"; position = "0 0"; - extent = "1156 704"; + extent = "641 40"; minExtent = "8 2"; horizSizing = "width"; - vertSizing = "height"; + vertSizing = "bottom"; profile = "GuiDefaultProfile"; visible = "1"; active = "1"; @@ -57,7 +59,7 @@ anchorBottom = "0"; anchorLeft = "1"; anchorRight = "0"; - position = "32 10"; + position = "32 7"; extent = "577 28"; minExtent = "8 2"; horizSizing = "right"; @@ -71,13 +73,33 @@ canSave = "1"; canSaveDynamicFields = "0"; }; + new GuiBitmapBarCtrl() { + percent = "100"; + vertical = "0"; + flipClip = "0"; + bitmap = "data/ui/images/panel_low.png"; + color = "255 255 255 255"; + position = "0 40"; + extent = "641 341"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; new GuiMLTextCtrl(MessageBoxText) { lineSpacing = "2"; allowColorChars = "0"; maxChars = "-1"; useURLMouseCursor = "0"; position = "81 83"; - extent = "481 14"; + extent = "481 19"; minExtent = "8 8"; horizSizing = "center"; vertSizing = "center"; @@ -91,8 +113,8 @@ canSaveDynamicFields = "0"; }; new GuiControl(MessageBoxButtonHolder) { - position = "0 237"; - extent = "641 130"; + position = "0 285"; + extent = "642 40"; minExtent = "8 2"; horizSizing = "center"; vertSizing = "top"; @@ -102,8 +124,190 @@ tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "1"; + class = "MenuInputButtonContainer"; canSave = "1"; canSaveDynamicFields = "0"; + + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Go"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "171 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "MainMenuButtonList.activateRow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "oc_OKButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Go"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "323 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "MainMenuButtonList.activateRow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "oc_CancelButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Go"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "251 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "MainMenuButtonList.activateRow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "OKButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Go"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "99 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "MainMenuButtonList.activateRow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "ync_yesButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Go"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "251 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "MainMenuButtonList.activateRow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "ync_noButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Go"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "403 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "MainMenuButtonList.activateRow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "ync_cancelButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; }; }; }; diff --git a/Templates/BaseGame/game/data/ui/guis/optionsMenu.cs b/Templates/BaseGame/game/data/ui/guis/optionsMenu.cs index a87447a2f..1604cc0b8 100644 --- a/Templates/BaseGame/game/data/ui/guis/optionsMenu.cs +++ b/Templates/BaseGame/game/data/ui/guis/optionsMenu.cs @@ -57,26 +57,17 @@ function OptionsMenu::onWake(%this) %this.pageTabIndex = 0; %tab = %this.getTab(); %tab.performClick(); + + OptionsButtonHolder.setActive(); } function OptionsButtonHolder::onWake(%this) { - %this.refresh(); -} - -function OptionsButtonHolder::refresh(%this) -{ - OptionsButtonHolder.add(GamepadButtonsGui); - - GamepadButtonsGui.clearButtons(); - - GamepadButtonsGui.setButton(0, "LB", "", "Prev Tab", "OptionsMenu.prevTab();", true); - GamepadButtonsGui.setButton(1, "RB", "", "Next Tab", "OptionsMenu.nextTab();", true); - GamepadButtonsGui.setButton(2, "Start", "Enter", "Apply", "OptionsMenu.apply();"); - GamepadButtonsGui.setButton(3, "B", "Esc", "Back", "OptionsMenu.backOut();"); - GamepadButtonsGui.setButton(7, "Back", "R", "Reset", "OptionsMenu.resetToDefaults();"); - - GamepadButtonsGui.refreshButtons(); + %this-->prevTabButton.set("LB", "", "Prev Tab", "OptionsMenu.prevTab();", true); + %this-->nextTabButton.set("RB", "", "Next Tab", "OptionsMenu.nextTab();", true); + %this-->resetButton.set("Back", "R", "Reset", "OptionsMenu.resetToDefaults();"); + %this-->applyButton.set("Start", "Enter", "Apply", "OptionsMenu.apply();"); + %this-->backButton.set("B", "Esc", "Back", "OptionsMenu.backOut();"); } function OptionsMenu::apply(%this) diff --git a/Templates/BaseGame/game/data/ui/guis/optionsMenu.gui b/Templates/BaseGame/game/data/ui/guis/optionsMenu.gui index 494b83ae7..54947cecd 100644 --- a/Templates/BaseGame/game/data/ui/guis/optionsMenu.gui +++ b/Templates/BaseGame/game/data/ui/guis/optionsMenu.gui @@ -13,6 +13,8 @@ isContainer = "1"; canSave = "1"; canSaveDynamicFields = "1"; + pageTabIndex = "0"; + returnGui = "MainMenuGui"; tamlReader = "20088"; tile = "0"; useVariable = "0"; @@ -32,6 +34,26 @@ canSave = "1"; canSaveDynamicFields = "0"; + new GuiBitmapBarCtrl() { + percent = "100"; + vertical = "0"; + flipClip = "0"; + bitmap = "data/ui/images/panel.png"; + color = "255 255 255 255"; + position = "0 0"; + extent = "927 40"; + minExtent = "8 2"; + horizSizing = "width"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; new GuiTextCtrl() { text = "OPTIONS"; maxLength = "1024"; @@ -41,7 +63,7 @@ anchorBottom = "0"; anchorLeft = "1"; anchorRight = "0"; - position = "22 10"; + position = "22 7"; extent = "120 28"; minExtent = "8 2"; horizSizing = "right"; @@ -59,20 +81,19 @@ percent = "100"; vertical = "0"; flipClip = "0"; - bitmap = "data/ui/images/hudfill.png"; + bitmap = "data/ui/images/panel_low.png"; color = "255 255 255 255"; position = "0 40"; - extent = "846 618"; + extent = "927 618"; minExtent = "8 2"; - horizSizing = "right"; + horizSizing = "width"; vertSizing = "bottom"; profile = "GuiDefaultProfile"; - visible = "0"; + visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "0"; - hidden = "1"; canSave = "1"; canSaveDynamicFields = "0"; }; @@ -89,13 +110,13 @@ profile = "GuiMenuButtonProfile"; visible = "1"; active = "1"; + command = "OptionsMenu.populateDisplaySettingsList();"; tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "0"; + internalName = "DisplayButton"; canSave = "1"; canSaveDynamicFields = "0"; - internalName = "DisplayButton"; - command="OptionsMenu.populateDisplaySettingsList();"; }; new GuiButtonCtrl() { text = "Graphics"; @@ -110,13 +131,13 @@ profile = "GuiMenuButtonProfile"; visible = "1"; active = "1"; + command = "OptionsMenu.populateGraphicsSettingsList();"; tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "0"; + internalName = "GraphicsButton"; canSave = "1"; canSaveDynamicFields = "0"; - internalName = "GraphicsButton"; - command="OptionsMenu.populateGraphicsSettingsList();"; }; new GuiButtonCtrl() { text = "Audio"; @@ -131,13 +152,13 @@ profile = "GuiMenuButtonProfile"; visible = "1"; active = "1"; + command = "OptionsMenu.populateAudioSettingsList();"; tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "0"; + internalName = "AudioButton"; canSave = "1"; canSaveDynamicFields = "0"; - internalName = "AudioButton"; - command="OptionsMenu.populateAudioSettingsList();"; }; new GuiButtonCtrl() { text = "Keyboard + Mouse"; @@ -152,13 +173,13 @@ profile = "GuiMenuButtonProfile"; visible = "1"; active = "1"; + command = "OptionsMenu.populateKeyboardMouseSettingsList();"; tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "0"; + internalName = "KBMButton"; canSave = "1"; canSaveDynamicFields = "0"; - internalName = "KBMButton"; - command="OptionsMenu.populateKeyboardMouseSettingsList();"; }; new GuiButtonCtrl() { text = "Gamepad"; @@ -173,13 +194,13 @@ profile = "GuiMenuButtonProfile"; visible = "1"; active = "1"; + command = "OptionsMenu.populateGamepadSettingsList();"; tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "0"; + internalName = "gamepadButton"; canSave = "1"; canSaveDynamicFields = "0"; - internalName = "GamepadButton"; - command="OptionsMenu.populateGamepadSettingsList();"; }; new GuiScrollCtrl() { willFirstRespond = "1"; @@ -211,13 +232,12 @@ canSaveDynamicFields = "0"; new GuiGameListMenuCtrl(OptionsMenuSettingsList) { - class = "UIMenuButtonList"; debugRender = "0"; callbackOnA = "OptionsMenuSettingsList.activateRow();"; callbackOnB = "OptionsMenuSettingsList.backOut();"; callbackOnInputs = "1"; position = "1 1"; - extent = "621 141"; + extent = "621 510"; minExtent = "8 2"; horizSizing = "width"; vertSizing = "bottom"; @@ -227,12 +247,12 @@ tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "0"; + class = "UIMenuButtonList"; canSave = "1"; canSaveDynamicFields = "0"; }; }; new GuiTextCtrl(OptionName) { - text = "Option"; maxLength = "1024"; margin = "0 0 0 0"; padding = "0 0 0 0"; @@ -265,7 +285,7 @@ minExtent = "8 2"; horizSizing = "right"; vertSizing = "bottom"; - profile = "GuiMLWhiteTextProfile"; + profile = "GuiMLTextProfile"; visible = "1"; active = "1"; tooltipProfile = "GuiToolTipProfile"; @@ -275,7 +295,7 @@ canSaveDynamicFields = "0"; }; }; - new GuiControl(OptionsButtonHolder) { + new GuiControl() { position = "189 652"; extent = "646 130"; minExtent = "8 2"; @@ -290,5 +310,169 @@ canSave = "1"; canSaveDynamicFields = "0"; }; + new GuiControl(OptionsButtonHolder) { + position = "109 711"; + extent = "791 40"; + minExtent = "8 2"; + horizSizing = "center"; + vertSizing = "top"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + class = "MenuInputButtonContainer"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Apply"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "507 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "ChooseLevelDlg.beginLevel();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "applyButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Esc"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Back"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "651 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "ChooseLevelDlg.backOut();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "backButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Prev Tab"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "0 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "prevTabButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Esc"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Next Tab"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "144 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "nextTabButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Esc"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Reset"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "325 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "resetButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; }; //--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/ui/guis/pauseMenu.cs b/Templates/BaseGame/game/data/ui/guis/pauseMenu.cs index a4519183a..0782fbe4a 100644 --- a/Templates/BaseGame/game/data/ui/guis/pauseMenu.cs +++ b/Templates/BaseGame/game/data/ui/guis/pauseMenu.cs @@ -8,6 +8,8 @@ function PauseMenuList::onAdd(%this) function PauseMenu::onWake(%this) { $timescale = 0; + + PauseButtonHolder.setActive(); } @@ -19,7 +21,7 @@ function PauseMenu::onSleep(%this) function PauseMenu::onReturnTo(%this) { PauseMenuList.hidden = false; - PauseButtonHolder.refresh(); + PauseButtonHolder.setActive(); } function openPauseMenuOptions() @@ -43,17 +45,6 @@ function pauseMenuExitToDesktop() function PauseButtonHolder::onWake(%this) { - %this.refresh(); -} - -function PauseButtonHolder::refresh(%this) -{ - PauseButtonHolder.add(GamepadButtonsGui); - - GamepadButtonsGui.clearButtons(); - - GamepadButtonsGui.setButton(2, "A", "", "", "", true); - GamepadButtonsGui.setButton(3, "B", "Esc", "Back", "Canvas.popDialog();"); - - GamepadButtonsGui.refreshButtons(); + %this-->goButton.set("A", "Enter", "OK", "PauseMenuList.activateRow();", true); + %this-->backButton.set("B", "Esc", "Back", "Canvas.popDialog();"); } \ No newline at end of file diff --git a/Templates/BaseGame/game/data/ui/guis/pauseMenu.gui b/Templates/BaseGame/game/data/ui/guis/pauseMenu.gui index e57da0c7c..9c97a3bce 100644 --- a/Templates/BaseGame/game/data/ui/guis/pauseMenu.gui +++ b/Templates/BaseGame/game/data/ui/guis/pauseMenu.gui @@ -36,7 +36,7 @@ canSaveDynamicFields = "1"; }; new GuiControl() { - position = "155 118"; + position = "162 125"; extent = "700 518"; minExtent = "8 2"; horizSizing = "center"; @@ -49,12 +49,9 @@ isContainer = "1"; canSave = "1"; canSaveDynamicFields = "0"; - + new GuiGameListMenuCtrl(PauseMenuList) { - class = "UIMenuButtonList"; debugRender = "0"; - callbackOnA = "OptionsMenuSettingsList.activateRow();"; - callbackOnB = "OptionsMenuSettingsList.backOut();"; callbackOnInputs = "1"; position = "0 0"; extent = "700 320"; @@ -67,14 +64,14 @@ tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "0"; + class = "UIMenuButtonList"; canSave = "1"; canSaveDynamicFields = "0"; }; }; - new GuiControl(PauseButtonHolder) { - position = "189 652"; - extent = "646 130"; + position = "189 711"; + extent = "646 40"; minExtent = "8 2"; horizSizing = "center"; vertSizing = "top"; @@ -84,8 +81,70 @@ tooltipProfile = "GuiToolTipProfile"; hovertime = "1000"; isContainer = "1"; + class = "MenuInputButtonContainer"; canSave = "1"; canSaveDynamicFields = "0"; + + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Enter"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "OK"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "363 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "PauseMenuList.activateRow();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "goButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiIconButtonCtrl() { + buttonMargin = "4 4"; + iconBitmap = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_Esc"; + iconLocation = "Left"; + sizeIconToButton = "1"; + makeIconSquare = "1"; + textLocation = "Right"; + textMargin = "4"; + autoSize = "0"; + text = "Back"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "507 0"; + extent = "140 40"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiMenuButtonProfile"; + visible = "1"; + active = "1"; + command = "Canvas.popDialog();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "backButton"; + class = "MenuInputButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; }; }; //--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/data/ui/guis/startupGui.cs b/Templates/BaseGame/game/data/ui/guis/startupGui.cs index e8252ce44..28c5cedce 100644 --- a/Templates/BaseGame/game/data/ui/guis/startupGui.cs +++ b/Templates/BaseGame/game/data/ui/guis/startupGui.cs @@ -33,7 +33,7 @@ function loadStartup() // to cycle through. Note that they have to // be in consecutive numerical order StartupGui.bitmap[0] = "data/ui/images/background-dark"; - StartupGui.logo[0] = "data/ui/images/Torque-3D-logo"; + StartupGui.logo[0] = "data/ui/images/Torque-3D-logo_alt"; StartupGui.logoPos[0] = "178 251"; StartupGui.logoExtent[0] = "443 139"; diff --git a/Templates/BaseGame/game/data/ui/images/background-dark.png b/Templates/BaseGame/game/data/ui/images/background-dark.png index 0bc3590d8..13b4bda55 100644 Binary files a/Templates/BaseGame/game/data/ui/images/background-dark.png and b/Templates/BaseGame/game/data/ui/images/background-dark.png differ diff --git a/Templates/BaseGame/game/data/ui/images/listMenuArray.png b/Templates/BaseGame/game/data/ui/images/listMenuArray.png index 4562c0451..e54b9ae08 100644 Binary files a/Templates/BaseGame/game/data/ui/images/listMenuArray.png and b/Templates/BaseGame/game/data/ui/images/listMenuArray.png differ diff --git a/Templates/BaseGame/game/data/ui/images/panel.png b/Templates/BaseGame/game/data/ui/images/panel.png new file mode 100644 index 000000000..71c72cd4e Binary files /dev/null and b/Templates/BaseGame/game/data/ui/images/panel.png differ diff --git a/Templates/BaseGame/game/data/ui/images/panel_low.png b/Templates/BaseGame/game/data/ui/images/panel_low.png new file mode 100644 index 000000000..a05ae5eee Binary files /dev/null and b/Templates/BaseGame/game/data/ui/images/panel_low.png differ diff --git a/Templates/BaseGame/game/data/ui/images/scrollBar.png b/Templates/BaseGame/game/data/ui/images/scrollBar.png index 7ab45acac..2699a7662 100644 Binary files a/Templates/BaseGame/game/data/ui/images/scrollBar.png and b/Templates/BaseGame/game/data/ui/images/scrollBar.png differ diff --git a/Templates/BaseGame/game/data/ui/scripts/default.keybinds.cs b/Templates/BaseGame/game/data/ui/scripts/default.keybinds.cs deleted file mode 100644 index 1706c2e44..000000000 --- a/Templates/BaseGame/game/data/ui/scripts/default.keybinds.cs +++ /dev/null @@ -1,103 +0,0 @@ -$movementSpeed = 1; // m/s - -function moveleft(%val) -{ - $mvLeftAction = %val * $movementSpeed; -} - -function moveright(%val) -{ - $mvRightAction = %val * $movementSpeed; -} - -function moveforward(%val) -{ - $mvForwardAction = %val * $movementSpeed; -} - -function movebackward(%val) -{ - $mvBackwardAction = %val * $movementSpeed; -} - -function gamePadMoveX( %val ) -{ - if(%val > 0) - { - $mvRightAction = %val * $movementSpeed; - $mvLeftAction = 0; - } - else - { - $mvRightAction = 0; - $mvLeftAction = -%val * $movementSpeed; - } -} - -function gamePadMoveY( %val ) -{ - if(%val > 0) - { - $mvForwardAction = %val * $movementSpeed; - $mvBackwardAction = 0; - } - else - { - $mvForwardAction = 0; - $mvBackwardAction = -%val * $movementSpeed; - } -} - -function gamepadYaw(%val) -{ - %yawAdj = getGamepadAdjustAmount(%val); - if(ServerConnection.isControlObjectRotDampedCamera()) - { - // Clamp and scale - %yawAdj = mClamp(%yawAdj, -m2Pi()+0.01, m2Pi()-0.01); - %yawAdj *= 0.5; - } - - if(%yawAdj > 0) - { - $mvYawLeftSpeed = %yawAdj; - $mvYawRightSpeed = 0; - } - else - { - $mvYawLeftSpeed = 0; - $mvYawRightSpeed = -%yawAdj; - } -} - -function gamepadPitch(%val) -{ - %pitchAdj = getGamepadAdjustAmount(%val); - if(ServerConnection.isControlObjectRotDampedCamera()) - { - // Clamp and scale - %pitchAdj = mClamp(%pitchAdj, -m2Pi()+0.01, m2Pi()-0.01); - %pitchAdj *= 0.5; - } - - if(%pitchAdj > 0) - { - $mvPitchDownSpeed = %pitchAdj; - $mvPitchUpSpeed = 0; - } - else - { - $mvPitchDownSpeed = 0; - $mvPitchUpSpeed = -%pitchAdj; - } -} - -moveMap.bind( keyboard, a, moveleft ); -moveMap.bind( keyboard, d, moveright ); -moveMap.bind( keyboard, w, moveforward ); -moveMap.bind( keyboard, s, movebackward ); - -moveMap.bind( gamepad, thumbrx, "D", "-0.23 0.23", gamepadYaw ); -moveMap.bind( gamepad, thumbry, "D", "-0.23 0.23", gamepadPitch ); -moveMap.bind( gamepad, thumblx, "D", "-0.23 0.23", gamePadMoveX ); -moveMap.bind( gamepad, thumbly, "D", "-0.23 0.23", gamePadMoveY ); \ No newline at end of file diff --git a/Templates/BaseGame/game/data/ui/guis/guiGamepadButton.cs b/Templates/BaseGame/game/data/ui/scripts/menuInputButtons.cs similarity index 51% rename from Templates/BaseGame/game/data/ui/guis/guiGamepadButton.cs rename to Templates/BaseGame/game/data/ui/scripts/menuInputButtons.cs index 92f17e86e..f802d2c88 100644 --- a/Templates/BaseGame/game/data/ui/guis/guiGamepadButton.cs +++ b/Templates/BaseGame/game/data/ui/scripts/menuInputButtons.cs @@ -15,39 +15,15 @@ $BUTTON_RSHOULDER = 9; $BUTTON_LSTICK = 10; $BUTTON_RSTICK = 11; -//------------------------------------------------------------------------------ -// GamepadButtonsGui methods -//------------------------------------------------------------------------------ - -/// Callback when this control wakes up. All buttons are set to invisible and -/// disabled. -function GamepadButtonsGui::onWake(%this) +function UIMenuButtonList::onInputEvent(%this, %device, %action, %state) { - GamepadButtonsGui.controllerName = "K&M"; + if(%state) + $activeMenuButtonContainer.processInputs(%device, %action); } -function GamepadButtonsGui::initMenuButtons(%this) +function UIMenuButtonList::onAxisEvent(%this, %device, %action, %axisVal) { - %buttonExt = %this.extent.x / 4 SPC %this.extent.y / 2; - - for(%i=0; %i < 9; %i++) - { - %btn = new GuiIconButtonCtrl() - { - iconLocation = "Left"; - sizeIconToButton = true; - makeIconSquare = true; - textLocation = "Right"; - extent = %buttonExt; - profile="GuiMenuButtonProfile"; - gamepadButton = ""; - keyboardButton = ""; - }; - - GamepadButtonsGui.addGuiControl(%btn); - } - - GamepadButtonsGui.refresh(); + $activeMenuButtonContainer.processAxisEvent(%device, %action); } /// Sets the command and text for the specified button. If %text and %command @@ -59,59 +35,153 @@ function GamepadButtonsGui::initMenuButtons(%this) /// \param %button (constant) The button to set. See: $BUTTON_A, _B, _X, _Y /// \param %text (string) The text to display next to the A button graphic. /// \param %command (string) The command executed when the A button is pressed. -function GamepadButtonsGui::setButton(%this, %buttonIdx, %gamepadButton, %keyboardButton, %text, %command, %gamepadOnly) +function MenuInputButton::set(%this, %gamepadButton, %keyboardButton, %text, %command, %gamepadOnly) { - if(%buttonIdx >= GamepadButtonsGui.getCount()) - return; - - %btn = GamepadButtonsGui.getObject(%buttonIdx); - %set = (! ((%text $= "") && (%command $= ""))); - %btn.setText(%text); - %btn.setActive(%set); - %btn.setVisible(%set); + %this.setText(%text); + %this.setActive(%set); + %this.setVisible(%set); - %btn.gamepadButton = %gamepadButton; - %btn.keyboardButton = %keyboardButton; + %this.gamepadButton = %gamepadButton; + %this.keyboardButton = %keyboardButton; if(%gamepadOnly $= "") %gamepadOnly = false; - %btn.gamepadOnly = %gamepadOnly; + %this.gamepadOnly = %gamepadOnly; - %btn.Command = %command; + %this.Command = %command; } -function GamepadButtonsGui::checkGamepad(%this) +function MenuInputButton::refresh(%this) { - %controllerName = SDLInputManager::JoystickNameForIndex(0); + + %set = (! ((%this.text $= "") && (%this.command $= ""))); - GamepadButtonsGui.controllerName = %controllerName; -} - -function GamepadButtonsGui::clearButtons(%this) -{ - for(%i=0; %i < GamepadButtonsGui.getCount(); %i++) - { - %btn = GamepadButtonsGui.getObject(%i); + //Special-case of where we're in keyboard+mouse mode, but the menubutton is gamepad only mode, so we early out + if(%this.gamepadOnly && $activeControllerName $= "K&M") + %set = false; - %btn.setBitmap(""); - %btn.text = ""; - %btn.command = ""; + %this.setActive(%set); + %this.setVisible(%set); + + if(!%this.isActive()) + return; + + if($activeControllerName !$= "K&M") + { + if(%this.gamepadButton !$= "") + { + %path = ""; + if($activeControllerName $= "PS4 Controller") + { + %path = "data/ui/images/inputs/PS4/PS4_"; + + if(%this.gamepadButton $= "A") + %path = %path @ "Cross"; + else if(%this.gamepadButton $= "B") + %path = %path @ "Circle"; + else if(%this.gamepadButton $= "X") + %path = %path @ "Square"; + else if(%this.gamepadButton $= "Y") + %path = %path @ "Triangle"; + else if(%this.gamepadButton $= "LB") + %path = %path @ "L1"; + else if(%this.gamepadButton $= "LT") + %path = %path @ "L2"; + else if(%this.gamepadButton $= "RB") + %path = %path @ "R1"; + else if(%this.gamepadButton $= "RT") + %path = %path @ "R2"; + //else + // continue; + } + else if($activeControllerName $= "Nintendo Switch Pro Controller") + { + %path = "data/ui/images/inputs/Switch/Switch_"; + + if(%this.gamepadButton $= "A") + %path = %path @ "B"; + else if(%this.gamepadButton $= "B") + %path = %path @ "A"; + else if(%this.gamepadButton $= "X") + %path = %path @ "Y"; + else if(%this.gamepadButton $= "Y") + %path = %path @ "X"; + else if(%this.gamepadButton $= "LB") + %path = %path @ "LB"; + else if(%this.gamepadButton $= "LT") + %path = %path @ "LT"; + else if(%this.gamepadButton $= "RB") + %path = %path @ "RB"; + else if(%this.gamepadButton $= "RT") + %path = %path @ "RT"; + //else + // continue; + } + else if($activeControllerName !$= "") + { + %path = "data/ui/images/inputs/Xbox/Xbox_"; + + %path = %path @ %this.gamepadButton; + } + } + } + else + { + if(%this.keyboardButton !$= "") + { + %path = "data/ui/images/Inputs/Keyboard & Mouse/Keyboard_Black_" @ %this.keyboardButton; + } + } + + %this.setBitmap(%path); + + return true; +} + +function MenuInputButtonContainer::refresh(%this) +{ + %count = %this.getCount(); + for(%i=0; %i < %count; %i++) + { + %btn = %this.getObject(%i); + + %btn.refresh(); } } -function GamepadButtonsGui::refreshButtons(%this) +function MenuInputButtonContainer::setActive(%this) +{ + if(isObject($activeMenuButtonContainer)) + $activeMenuButtonContainer.hidden = true; + + $activeMenuButtonContainer = %this; + $activeMenuButtonContainer.hidden = false; + $activeMenuButtonContainer.refresh(); +} + +function MenuInputButtonContainer::checkGamepad(%this) +{ + %controllerName = SDLInputManager::JoystickNameForIndex(0); + + $activeControllerName = %controllerName; + + if($activeControllerName $= "") + $activeControllerName = "K&M"; +} + +function MenuInputButtonContainer::refreshButtons(%this) { //Set up our basic buttons - for(%i=0; %i < GamepadButtonsGui.getCount(); %i++) + for(%i=0; %i < %this.getCount(); %i++) { - %btn = GamepadButtonsGui.getObject(%i); + %btn = %this.getObject(%i); %set = (! ((%btn.text $= "") && (%btn.command $= ""))); //Special-case of where we're in keyboard+mouse mode, but the menubutton is gamepad only mode, so we early out - if(%btn.gamepadOnly && GamepadButtonsGui.controllerName $= "K&M") + if(%btn.gamepadOnly && $activeControllerName $= "K&M") %set = false; %btn.setActive(%set); @@ -120,12 +190,12 @@ function GamepadButtonsGui::refreshButtons(%this) if(!%btn.isActive()) continue; - if(GamepadButtonsGui.controllerName !$= "K&M") + if($activeControllerName !$= "K&M") { if(%btn.gamepadButton !$= "") { %path = ""; - if(GamepadButtonsGui.controllerName $= "PS4 Controller") + if($activeControllerName $= "PS4 Controller") { %path = "data/ui/images/inputs/PS4/PS4_"; @@ -148,7 +218,7 @@ function GamepadButtonsGui::refreshButtons(%this) else continue; } - else if(GamepadButtonsGui.controllerName $= "Nintendo Switch Pro Controller") + else if($activeControllerName $= "Nintendo Switch Pro Controller") { %path = "data/ui/images/inputs/Switch/Switch_"; @@ -171,7 +241,7 @@ function GamepadButtonsGui::refreshButtons(%this) else continue; } - else if(GamepadButtonsGui.controllerName !$= "") + else if($activeControllerName !$= "") { %path = "data/ui/images/inputs/Xbox/Xbox_"; @@ -193,58 +263,66 @@ function GamepadButtonsGui::refreshButtons(%this) return true; } -function GamepadButtonsGui::processInputs(%this, %device, %action) +function MenuInputButtonContainer::processInputs(%this, %device, %action) { //check to see if our status has changed %changed = false; - %oldDevice = GamepadButtonsGui.controllerName; + %oldDevice = $activeControllerName; if(startsWith(%device, "Keyboard")) { - if(GamepadButtonsGui.controllerName !$= %device) + if($activeControllerName !$= %device) %changed = true; - GamepadButtonsGui.controllerName = "K&M"; + $activeControllerName = "K&M"; Canvas.showCursor(); } else if(startsWith(%device, "Mouse")) { if(startsWith(%action, "button")) { - if(GamepadButtonsGui.controllerName !$= %device) + if($activeControllerName !$= %device) %changed = true; - GamepadButtonsGui.controllerName = "K&M"; + $activeControllerName = "K&M"; Canvas.showCursor(); } } else { - if(GamepadButtonsGui.checkGamepad()) + if(%this.checkGamepad()) { Canvas.hideCursor(); } - if(GamepadButtonsGui.controllerName !$= %device) + if($activeControllerName !$= %device) %changed = true; } if(%changed) - GamepadButtonsGui.refreshButtons(); + %this.refresh(); //Now process the input for the button accelerator, if applicable //Set up our basic buttons - for(%i=0; %i < GamepadButtonsGui.getCount(); %i++) + for(%i=0; %i < %this.getCount(); %i++) { - %btn = GamepadButtonsGui.getObject(%i); + %btn = %this.getObject(%i); if(!%btn.isActive()) continue; - if(GamepadButtonsGui.controllerName !$= "K&M") + if($activeControllerName !$= "K&M") { - if(%action $= "btn_r") + if(%action $= "btn_a") + %action = "A"; + else if(%action $= "btn_b") + %action = "B"; + else if(%action $= "btn_x") + %action = "X"; + else if(%action $= "btn_y") + %action = "Y"; + else if(%action $= "btn_r") %action = "RB"; else if(%action $= "btn_l") %action = "LB"; @@ -269,36 +347,36 @@ function GamepadButtonsGui::processInputs(%this, %device, %action) } } -function GamepadButtonsGui::processAxisEvent(%this, %device, %action, %axisVal) +function MenuInputButtonContainer::processAxisEvent(%this, %device, %action, %axisVal) { %changed = false; - %oldDevice = GamepadButtonsGui.controllerName; + %oldDevice = $activeControllerName; if(startsWith(%device, "Mouse")) { if(startsWith(%action, "button")) { - if(GamepadButtonsGui.controllerName !$= %device) + if($activeControllerName !$= %device) %changed = true; - GamepadButtonsGui.controllerName = "K&M"; + $activeControllerName = "K&M"; Canvas.showCursor(); } } else { - if(GamepadButtonsGui.checkGamepad()) + if(%this.checkGamepad()) { Canvas.hideCursor(); } - if(GamepadButtonsGui.controllerName !$= %device) + if($activeControllerName !$= %device) %changed = true; } if(%changed) - GamepadButtonsGui.refreshButtons(); + %this.refresh(); } // // diff --git a/Templates/BaseGame/game/data/ui/scripts/messageBoxes.cs b/Templates/BaseGame/game/data/ui/scripts/messageBoxes.cs index 6c39682e7..7e3233e1a 100644 --- a/Templates/BaseGame/game/data/ui/scripts/messageBoxes.cs +++ b/Templates/BaseGame/game/data/ui/scripts/messageBoxes.cs @@ -44,9 +44,6 @@ new SFXProfile(messageBoxBeep) //--------------------------------------------------------------------------------------------- function messageCallback(%dlg, %callback) { - MessageBoxDlg.originalMenubuttonContainer.add(GamepadButtonsGui); - MessageBoxDlg.originalMenubuttonContainer.refresh(); - Canvas.popDialog(%dlg); eval(%callback); } @@ -85,6 +82,10 @@ function MBSetText(%text, %frame, %msg) //sfxPlayOnce( messageBoxBeep ); } +function MessageBoxCtrl::onWake(%this) +{ +} + //--------------------------------------------------------------------------------------------- // Various message box display functions. Each one takes a window title, a message, and a // callback for each button. @@ -96,12 +97,15 @@ function MessageBoxOK(%title, %message, %callback) Canvas.pushDialog(MessageBoxDlg); MessageBoxTitleText.text = %title; - MessageBoxDlg.originalMenubuttonContainer = GamepadButtonsGui.getParent(); + MessageBoxButtonHolder-->OKButton.set("A", "Enter", "OK", "MessageCallback(MessageBoxDlg,MessageBoxDlg.callback);"); - MessageBoxButtonHolder.add(GamepadButtonsGui); - GamepadButtonsGui.clearButtons(); - GamepadButtonsGui.setButton(7, "A", "", "OK", "MessageCallback(MessageBoxDlg,MessageBoxDlg.callback);"); - GamepadButtonsGui.refreshButtons(); + MessageBoxButtonHolder.setActive(); + + MessageBoxButtonHolder-->oc_OKButton.hidden = true; + MessageBoxButtonHolder-->oc_CancelButton.hidden = true; + MessageBoxButtonHolder-->ync_yesButton.hidden = true; + MessageBoxButtonHolder-->ync_noButton.hidden = true; + MessageBoxButtonHolder-->ync_CancelButton.hidden = true; MBSetText(MessageBoxText, MessageBoxCtrl, %message); MessageBoxDlg.callback = %callback; @@ -117,13 +121,15 @@ function MessageBoxOKCancel(%title, %message, %callback, %cancelCallback) Canvas.pushDialog(MessageBoxDlg); MessageBoxTitleText.text = %title; - MessageBoxDlg.originalMenubuttonContainer = GamepadButtonsGui.getParent(); + MessageBoxButtonHolder-->oc_OKButton.set("A", "Enter", "OK", "MessageCallback(MessageBoxDlg,MessageBoxDlg.callback);"); + MessageBoxButtonHolder-->oc_CancelButton.set("B", "Esc", "Cancel", "MessageCallback(MessageBoxDlg,MessageBoxDlg.cancelCallback);"); + + MessageBoxButtonHolder.setActive(); - MessageBoxButtonHolder.add(GamepadButtonsGui); - GamepadButtonsGui.clearButtons(); - GamepadButtonsGui.setButton(5, "A", "", "OK", "MessageCallback(MessageBoxDlg,MessageBoxDlg.callback);"); - GamepadButtonsGui.setButton(6, "B", "", "Cancel", "MessageCallback(MessageBoxDlg,MessageBoxDlg.cancelCallback);"); - GamepadButtonsGui.refreshButtons(); + MessageBoxButtonHolder-->OKButton.hidden = true; + MessageBoxButtonHolder-->ync_yesButton.hidden = true; + MessageBoxButtonHolder-->ync_noButton.hidden = true; + MessageBoxButtonHolder-->ync_CancelButton.hidden = true; MBSetText(MessageBoxText, MessageBoxCtrl, %message); MessageBoxDlg.callback = %callback; @@ -211,13 +217,15 @@ function MessageBoxYesNo(%title, %message, %yesCallback, %noCallback) Canvas.pushDialog(MessageBoxDlg); MessageBoxTitleText.text = %title; - MessageBoxDlg.originalMenubuttonContainer = GamepadButtonsGui.getParent(); + MessageBoxButtonHolder-->oc_OKButton.set("A", "Enter", "Yes", "MessageCallback(MessageBoxDlg,MessageBoxDlg.yesCallBack);"); + MessageBoxButtonHolder-->oc_CancelButton.set("B", "Esc", "No", "MessageCallback(MessageBoxDlg,MessageBoxDlg.noCallback);"); - MessageBoxButtonHolder.add(GamepadButtonsGui); - GamepadButtonsGui.clearButtons(); - GamepadButtonsGui.setButton(5, "A", "", "Yes", "MessageCallback(MessageBoxDlg,MessageBoxDlg.yesCallBack);"); - GamepadButtonsGui.setButton(6, "B", "", "No", "MessageCallback(MessageBoxDlg,MessageBoxDlg.noCallback);"); - GamepadButtonsGui.refreshButtons(); + MessageBoxButtonHolder.setActive(); + + MessageBoxButtonHolder-->OKButton.hidden = true; + MessageBoxButtonHolder-->ync_yesButton.hidden = true; + MessageBoxButtonHolder-->ync_noButton.hidden = true; + MessageBoxButtonHolder-->ync_CancelButton.hidden = true; MBSetText(MessageBoxText, MessageBoxCtrl, %message); MessageBoxDlg.yesCallBack = %yesCallback; @@ -229,14 +237,15 @@ function MessageBoxYesNoCancel(%title, %message, %yesCallback, %noCallback, %can Canvas.pushDialog(MessageBoxDlg); MessageBoxTitleText.text = %title; - MessageBoxDlg.originalMenubuttonContainer = GamepadButtonsGui.getParent(); + MessageBoxButtonHolder-->ync_yesButton.set("A", "Enter", "Yes", "MessageCallback(MessageBoxDlg,MessageBoxDlg.yesCallBack);"); + MessageBoxButtonHolder-->ync_noButton.set("X", "Backspace", "No", "MessageCallback(MessageBoxDlg,MessageBoxDlg.noCallback);"); + MessageBoxButtonHolder-->ync_cancelButton.set("B", "Esc", "No", "MessageCallback(MessageBoxDlg,MessageBoxDlg.cancelCallback);"); - MessageBoxButtonHolder.add(GamepadButtonsGui); - GamepadButtonsGui.clearButtons(); - GamepadButtonsGui.setButton(5, "A", "", "Yes", "MessageCallback(MessageBoxDlg,MessageBoxDlg.yesCallBack);"); - GamepadButtonsGui.setButton(6, "B", "", "No", "MessageCallback(MessageBoxDlg,MessageBoxDlg.noCallback);"); - GamepadButtonsGui.setButton(7, "Back", "", "Cancel", "MessageCallback(MessageBoxDlg,MessageBoxDlg.cancelCallback);"); - GamepadButtonsGui.refreshButtons(); + MessageBoxButtonHolder.setActive(); + + MessageBoxButtonHolder-->OKButton.hidden = true; + MessageBoxButtonHolder-->oc_OKButton.hidden = true; + MessageBoxButtonHolder-->oc_CancelButton.hidden = true; MBSetText(MessageBoxText, MessageBoxCtrl, %message); MessageBoxDlg.yesCallBack = %yesCallback; diff --git a/Templates/BaseGame/game/data/ui/scripts/profiles.cs b/Templates/BaseGame/game/data/ui/scripts/profiles.cs index 26a7bd3a9..c0ea8d442 100644 --- a/Templates/BaseGame/game/data/ui/scripts/profiles.cs +++ b/Templates/BaseGame/game/data/ui/scripts/profiles.cs @@ -1,12 +1,15 @@ +$TextMediumEmphasisColor = "200 200 200"; +$TextHighEmphasisColor = "224 224 224"; +$TextDisabledColor = "108 108 108"; new GuiGameListMenuProfile(DefaultListMenuProfile) { fontType = "Arial Bold"; fontSize = 20; - fontColor = "120 120 120"; - fontColorSEL = "16 16 16"; - fontColorNA = "200 200 200"; - fontColorHL = "100 100 120"; + fontColor = $TextMediumEmphasisColor; + fontColorSEL = $TextMediumEmphasisColor; + fontColorNA = $TextDisabledColor; + fontColorHL = $TextMediumEmphasisColor; HitAreaUpperLeft = "16 20"; HitAreaLowerRight = "503 74"; IconOffset = "40 0"; @@ -40,7 +43,7 @@ new GuiControlProfile(MenuHeaderText) { fontType = "Arial Bold"; fontSize = 30; - fontColor = "255 255 255"; + fontColor = $TextHighEmphasisColor; justify = "left"; }; @@ -48,7 +51,7 @@ new GuiControlProfile(MenuHeaderTextCenter) { fontType = "Arial Bold"; fontSize = 30; - fontColor = "255 255 255"; + fontColor = $TextHighEmphasisColor; justify = "center"; }; @@ -56,7 +59,7 @@ new GuiControlProfile(MenuSubHeaderText) { fontType = "Arial Bold"; fontSize = 20; - fontColor = "255 255 255"; + fontColor = $TextMediumEmphasisColor; justify = "left"; }; @@ -64,7 +67,7 @@ new GuiControlProfile(MenuMLSubHeaderText) { fontType = "Arial Bold"; fontSize = 20; - fontColor = "255 255 255"; + fontColor = $TextMediumEmphasisColor; justify = "left"; autoSizeWidth = true; autoSizeHeight = true; @@ -74,23 +77,23 @@ if( !isObject( GuiMenuButtonProfile ) ) new GuiControlProfile( GuiMenuButtonProfile ) { opaque = true; - border = false; + border = true; fontSize = 18; fontType = "Arial Bold"; - fontColor = "200 200 200"; - fontColorHL = "80 80 80"; - fontColorNA = "0 0 0"; - fontColorSEL = "0 0 0"; - fillColor = "255 255 255 120"; - fillColorHL = "100 100 100 50"; - fillColorNA = "0 0 0 50"; - borderColor = "0 0 0 0"; - borderColorNA = "0 0 0 0"; - borderColorHL = "0 0 0 0"; + fontColor = $TextMediumEmphasisColor; + fontColorHL = $TextMediumEmphasisColor; + fontColorNA = $TextDisabledColor; + fontColorSEL = $TextMediumEmphasisColor; + fillColor = "40 40 40"; + fillColorHL = "56 56 56"; + fillColorNA = "40 40 40"; + borderColor = "87 87 87"; + borderColorNA = "0 0 0"; + borderColorHL = "255 255 255"; fixedExtent = false; justify = "center"; canKeyFocus = false; - bitmap = "data/ui/images/menu-button"; + //bitmap = "data/ui/images/menu-button"; hasBitmapArray = false; soundButtonDown = menuButtonPressed; soundButtonOver = menuButtonHover; @@ -255,8 +258,13 @@ new GuiControlProfile( GuiBigTextProfile : GuiTextProfile ) if( !isObject( GuiMLTextProfile ) ) new GuiControlProfile( GuiMLTextProfile ) { + fontColor = $TextMediumEmphasisColor; + fontColorHL = $TextMediumEmphasisColor; + fontColorSEL = $TextMediumEmphasisColor; + fontColorNA = $TextDisabledColor; + fontColorLink = "100 100 100"; - fontColorLinkHL = "255 255 255"; + fontColorLinkHL = $TextMediumEmphasisColor; autoSizeWidth = true; autoSizeHeight = true; border = false; @@ -267,7 +275,7 @@ if( !isObject( GuiMLWhiteTextProfile ) ) new GuiControlProfile( GuiMLWhiteTextProfile ) { fontColor = "220 220 220"; - fontColorHL = "255 255 255"; + fontColorHL = $TextMediumEmphasisColor; autoSizeWidth = true; autoSizeHeight = true; border = false; @@ -277,17 +285,43 @@ new GuiControlProfile( GuiMLWhiteTextProfile ) if( !isObject( GuiTextArrayProfile ) ) new GuiControlProfile( GuiTextArrayProfile : GuiTextProfile ) { - fontColor = "250 250 250"; - fontColorHL = " 0 0 0"; - fontColorSEL = "0 0 0"; - fillColor ="50 50 50"; - fillColorHL = "125 125 125"; - fillColorSEL = "180 180 180"; - border = false; + fontColor = $TextMediumEmphasisColor; + fontColorHL = $TextMediumEmphasisColor; + fontColorSEL = $TextMediumEmphasisColor; + fontColorNA = $TextDisabledColor; + + fillColor = "22 22 22 255"; + fillColorHL = "22 22 22 255"; + fillColorSEL = "56 56 56 255"; + + border = true; + borderColor ="87 87 87"; + borderColorHL = "87 87 87"; + borderColorSEL = "255 255 255"; + category = "Core"; canKeyFocus = true; }; +if( !isObject( GuiMenuTextEditProfile ) ) +new GuiControlProfile( GuiMenuTextEditProfile : GuiTextEditProfile ) +{ + fontColor = $TextMediumEmphasisColor; + fontColorHL = $TextMediumEmphasisColor; + fontColorSEL = $TextMediumEmphasisColor; + fontColorNA = $TextDisabledColor; + + fillColor = "22 22 22 255"; + fillColorHL = "22 22 22 255"; + + border = true; + borderColor ="87 87 87"; + borderColorHL = "87 87 87"; + borderColorSEL = "255 255 255"; + + category = "Core"; +}; + // ---------------------------------------------------------------------------- // TODO: Revisit Popupmenu // ---------------------------------------------------------------------------- @@ -484,7 +518,7 @@ if(!isObject(GuiMenuScrollProfile)) new GuiControlProfile(GuiMenuScrollProfile) { opaque = false; - fillcolor = "50 50 50"; + fillcolor = "22 22 22"; fontColor = "200 200 200"; fontColorHL = "250 250 250"; border = false;