Refactored the input display menu to allow for dynamic changing of row displays. Remove controller specific keybinding menu, integrating with initial keyboard menu.
This commit is contained in:
@@ -554,4 +554,31 @@ void InputGroup::AddPrimaryKeybind(Input key){
|
||||
void InputGroup::SetNewPrimaryKeybind(Input key){
|
||||
RemovePrimaryKeybind(key.GetType());
|
||||
AddPrimaryKeybind(key);
|
||||
}
|
||||
|
||||
void InputListener::Update(){
|
||||
#pragma region New controller input binding listener
|
||||
using A=Attribute;
|
||||
if(Menu::IsMenuOpen()&&Menu::stack.back()==Menu::menus[NEW_INPUT]&&!Menu::menus[NEW_INPUT]->B(A::IS_KEYBOARD)){ //We are requesting a brand new controller input.
|
||||
if(InputGroup::menuNamesToInputGroups.count(Menu::menus[NEW_INPUT]->S(A::KEYBIND))){
|
||||
for(GamePad*gamepad:GamePad::getGamepads()){
|
||||
for(size_t button=0;bool hasButton:gamepad->availableButtons){
|
||||
GPButtons releasedButton=olc::GPButtons(button);
|
||||
if(hasButton&&gamepad->getButton(releasedButton).bReleased){
|
||||
if(releasedButton==GPButtons::SELECT){ //If we hit select we don't bother with setting the input and leave immediately.
|
||||
Menu::CloseMenu();
|
||||
return;
|
||||
}
|
||||
|
||||
InputGroup::menuNamesToInputGroups[Menu::menus[NEW_INPUT]->S(A::KEYBIND)]->SetNewPrimaryKeybind(Input{CONTROLLER,int(button)});
|
||||
Menu::alreadyClicked=true;
|
||||
Menu::CloseMenu();
|
||||
return;
|
||||
}
|
||||
button++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
}
|
||||
Reference in New Issue
Block a user