Added ability to set controller keybinds. Fixed initial loading of save data when no metadata file is detected or present for online builds. Fixed "Online Character" checkbox being desynced when selecting the Online character mode, enabling online mode. Display context-sensitive messages for setting keys depending on whether we are in keyboard mode or controller mode. Release build 6866.
This commit is contained in:
@@ -47,6 +47,7 @@ All rights reserved.
|
||||
#include "MenuLabel.h"
|
||||
#include "Slider.h"
|
||||
#include "Checkbox.h"
|
||||
#include "InputDisplayComponent.h"
|
||||
|
||||
INCLUDE_DATA
|
||||
INCLUDE_game
|
||||
@@ -92,9 +93,41 @@ void Menu::InitializeSettingsWindow(){
|
||||
return true;
|
||||
},false)END;
|
||||
settingsWindow->ADD("Keyboard Play Auto-Aim Label",MenuLabel)(geom2d::rect<float>{{windowSize.x/2-68.f,104},{windowSize.x/2+54.f,16.f}},"Keyboard Aim Assist\n (For Keyboard Only Players)",1.f,ComponentAttr::SHADOW)END;
|
||||
|
||||
#pragma region Setup all input displays as keyboard controls.
|
||||
//NOTE: We are shadowing code from InputKeyboardWindow! If at some point the retrival method for getting input displays changes, we likely will be changing the code here as well!
|
||||
auto ChangeKeybindDisplayType=[&](InputType inputType){
|
||||
const int menuRowCount=DATA.GetProperty("Inputs.Menu Input Names").GetValueCount()%2==0?DATA.GetProperty("Inputs.Menu Input Names").GetValueCount()/2:DATA.GetProperty("Inputs.Menu Input Names").GetValueCount()/2+1;
|
||||
const int menuColCount=2;
|
||||
for(int row=0;row<menuRowCount;row++){
|
||||
for(int col=0;col<menuColCount;col++){
|
||||
if(DATA.GetProperty("Inputs.Menu Input Names").GetValueCount()%2==1&&col==1&&row==menuRowCount-1)continue; //We only continue on a blank space when we have an odd number of elements.
|
||||
Component<InputDisplayComponent>(INPUT_KEY_DISPLAY,std::format("Input_{}_{} Input Displayer",row,col))->SetKeyType(inputType);
|
||||
}
|
||||
}
|
||||
const int ingameControlsRowCount=DATA.GetProperty("Inputs.Gameplay Input Names").GetValueCount()%2==0?DATA.GetProperty("Inputs.Gameplay Input Names").GetValueCount()/2:DATA.GetProperty("Inputs.Gameplay Input Names").GetValueCount()/2+1;
|
||||
const int ingameControlsColCount=2;
|
||||
for(int row=0;row<ingameControlsRowCount;row++){
|
||||
for(int col=0;col<ingameControlsColCount;col++){
|
||||
if(DATA.GetProperty("Inputs.Gameplay Input Names").GetValueCount()%2==1&&col==1&&row==ingameControlsRowCount-1)continue; //We only continue on a blank space when we have an odd number of elements.
|
||||
Component<InputDisplayComponent>(INPUT_KEY_DISPLAY,std::format("Input_{}_{} Gameplay Input Displayer",row,col))->SetKeyType(inputType);
|
||||
}
|
||||
}
|
||||
};
|
||||
#pragma endregion
|
||||
|
||||
settingsWindow->ADD("Keyboard Bindings Button",MenuComponent)(geom2d::rect<float>{{28,132.f},vf2d{windowSize.x-32,24}},"Keyboard Bindings",MenuType::INPUT_KEY_DISPLAY,DO_NOTHING,vf2d{1.5f,2.f})END;
|
||||
settingsWindow->ADD("Controller Bindings Button",MenuComponent)(geom2d::rect<float>{{28,160.f},vf2d{windowSize.x-32,24}},"Controller Bindings",MenuType::INPUT_KEY_DISPLAY,DO_NOTHING,vf2d{1.5f,2.f})END;
|
||||
settingsWindow->ADD("Keyboard Bindings Button",MenuComponent)(geom2d::rect<float>{{28,132.f},vf2d{windowSize.x-32,24}},"Keyboard Bindings",MenuType::ENUM_END,[&](MenuFuncData data){
|
||||
ChangeKeybindDisplayType(KEY);
|
||||
Component<MenuLabel>(INPUT_KEY_DISPLAY,"Keyboard Mapping Label")->SetLabel("Keyboard Mappings");
|
||||
Menu::OpenMenu(INPUT_KEY_DISPLAY);
|
||||
return true;
|
||||
},vf2d{1.5f,2.f})END;
|
||||
settingsWindow->ADD("Controller Bindings Button",MenuComponent)(geom2d::rect<float>{{28,160.f},vf2d{windowSize.x-32,24}},"Controller Bindings",MenuType::ENUM_END,[&](MenuFuncData data){
|
||||
ChangeKeybindDisplayType(CONTROLLER);
|
||||
Component<MenuLabel>(INPUT_KEY_DISPLAY,"Keyboard Mapping Label")->SetLabel("Controller Mappings");
|
||||
Menu::OpenMenu(INPUT_KEY_DISPLAY);
|
||||
return true;
|
||||
},vf2d{1.5f,2.f})END;
|
||||
|
||||
settingsWindow->ADD("Go Back",MenuComponent)(geom2d::rect<float>{vf2d{windowSize.x/2.f,windowSize.y}-vf2d{36,16},{72,12}},"Go Back",[](MenuFuncData data){
|
||||
Menu::CloseMenu();
|
||||
|
||||
Reference in New Issue
Block a user