Moved settings related to the game itself into its own settings save file. Emscripten build also saves a separate system settings file in indexeddb. Added checks to prevent menu sounds from playing when the menu is not currently open, but adjusted in a different location in the game. Implemented different button icon sets and a setting to toggle between them. Removed the double button display (caused more confusion and took up more room). Fixed a bug with iterating through navigation groups when a button was removed/disabled from the list. Removed iconscaling dependency based on MenuIconButton sizes.
This commit is contained in:
@@ -400,9 +400,27 @@ void InputGroup::DrawInput(const std::variant<AiL*const,TileTransformedView*cons
|
||||
const bool Input::HasIcon()const{
|
||||
return GenericKey::keyLiteral.at({type,key}).iconName.length()>0;
|
||||
}
|
||||
const bool Input::HasExtendedIcons()const{
|
||||
return GenericKey::keyLiteral.at({type,key}).iconName.length()>0&&GenericKey::keyLiteral.at({type,key}).iconName2.length()>0&&GenericKey::keyLiteral.at({type,key}).iconName3.length()>0;
|
||||
}
|
||||
const Renderable&Input::GetIcon()const{
|
||||
return GFX.at(GenericKey::keyLiteral.at({type,key}).iconName);
|
||||
}
|
||||
const Renderable&Input::GetIcon(IconType type)const{
|
||||
switch(type){
|
||||
case IconType::XB:{
|
||||
return GFX.at(GenericKey::keyLiteral.at({this->type,key}).iconName);
|
||||
}break;
|
||||
case IconType::PS:{
|
||||
return GFX.at(GenericKey::keyLiteral.at({this->type,key}).iconName2);
|
||||
}break;
|
||||
case IconType::XB_REVERSED:{
|
||||
return GFX.at(GenericKey::keyLiteral.at({this->type,key}).iconName3);
|
||||
}break;
|
||||
}
|
||||
ERR("WARNING! Did not handle a valid controller icon type. THIS SHOULD NOT BE HAPPENING!");
|
||||
return GFX.at("themes/button_d_xb.png");
|
||||
}
|
||||
|
||||
#undef END
|
||||
|
||||
@@ -510,10 +528,10 @@ std::map<std::pair<InputType,int>,GenericKey::KeyInfo> GenericKey::keyLiteral={
|
||||
{{MOUSE, Mouse::LEFT},{"L.MOUSE","themes/lmb.png"}},
|
||||
{{MOUSE, Mouse::RIGHT},{"R.MOUSE","themes/rmb.png"}},
|
||||
{{MOUSE, Mouse::MIDDLE},{"M.MOUSE","themes/mmb.png"}},
|
||||
{{CONTROLLER, static_cast<int>(GPButtons::FACE_D)},{"A/X","themes/button_d.png"}},
|
||||
{{CONTROLLER, static_cast<int>(GPButtons::FACE_L)},{"X/Square","themes/button_l.png"}},
|
||||
{{CONTROLLER, static_cast<int>(GPButtons::FACE_R)},{"B/Circle","themes/button_r.png"}},
|
||||
{{CONTROLLER, static_cast<int>(GPButtons::FACE_U)},{"Y/Triangle","themes/button_u.png"}},
|
||||
{{CONTROLLER, static_cast<int>(GPButtons::FACE_D)},{"A/X","themes/button_d_xb.png","themes/button_d_ps.png","themes/button_r_xb.png"}},
|
||||
{{CONTROLLER, static_cast<int>(GPButtons::FACE_L)},{"X/Square","themes/button_l_xb.png","themes/button_l_ps.png","themes/button_u_xb.png"}},
|
||||
{{CONTROLLER, static_cast<int>(GPButtons::FACE_R)},{"B/Circle","themes/button_r_xb.png","themes/button_r_ps.png","themes/button_d_xb.png"}},
|
||||
{{CONTROLLER, static_cast<int>(GPButtons::FACE_U)},{"Y/Triangle","themes/button_u_xb.png","themes/button_u_ps.png","themes/button_l_xb.png"}},
|
||||
{{CONTROLLER, static_cast<int>(GPButtons::L1)},{"L1","themes/button_l1.png"}},
|
||||
{{CONTROLLER, static_cast<int>(GPButtons::L2)},{"L2","themes/button_l2.png"}},
|
||||
{{CONTROLLER, static_cast<int>(GPButtons::L3)},{"L3"}},
|
||||
@@ -648,23 +666,28 @@ void InputGroup::SetNewPrimaryKeybind(Input 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(gamepad->getButton(releasedButton).bReleased){
|
||||
InputGroup::menuNamesToInputGroups[Menu::menus[NEW_INPUT]->S(A::KEYBIND)]->SetNewPrimaryKeybind(Input{CONTROLLER,int(button)});
|
||||
for(auto&[menuType,menu]:Menu::menus){
|
||||
menu->helpDisplay.Initialize(menu->inputGroups);
|
||||
if(Menu::IsMenuOpen()&&Menu::stack.back()==Menu::menus[NEW_INPUT]){
|
||||
if(!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(gamepad->getButton(releasedButton).bReleased){
|
||||
InputGroup::menuNamesToInputGroups[Menu::menus[NEW_INPUT]->S(A::KEYBIND)]->SetNewPrimaryKeybind(Input{CONTROLLER,int(button)});
|
||||
for(auto&[menuType,menu]:Menu::menus){
|
||||
menu->helpDisplay.Initialize(menu->inputGroups);
|
||||
}
|
||||
Menu::alreadyClicked=true;
|
||||
Menu::CloseMenu();
|
||||
return;
|
||||
}
|
||||
Menu::alreadyClicked=true;
|
||||
Menu::CloseMenu();
|
||||
return;
|
||||
button++;
|
||||
}
|
||||
button++;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
Menu::alreadyClicked=true;
|
||||
Menu::CloseMenu();
|
||||
}
|
||||
}
|
||||
#pragma endregion
|
||||
|
||||
Reference in New Issue
Block a user