diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj index 21190f13..a953d549 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj @@ -351,6 +351,10 @@ + + + + @@ -586,10 +590,18 @@ + + + + + + + + @@ -749,6 +761,7 @@ + diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters index a4884c87..3cf88cf0 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters @@ -85,6 +85,9 @@ {c28287fa-b401-4715-b2f2-8ac1021d5ec9} + + {c90a78bc-c74d-4609-b758-69320d7741e5} + @@ -447,6 +450,9 @@ Header Files + + Header Files\Interface + @@ -779,6 +785,12 @@ Source Files + + Source Files\Interface + + + Source Files\Interface + @@ -930,6 +942,9 @@ Configurations + + Configurations\Setttings + diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index f1c83335..e36caacc 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -112,6 +112,7 @@ InputGroup AiL::KEY_SCROLLDOWN; InputGroup AiL::KEY_BACK; InputGroup AiL::KEY_START; InputGroup AiL::KEY_SELECT; +InputGroup AiL::KEY_UNEQUIP; InputGroup AiL::KEY_SCROLL; InputGroup AiL::KEY_CHANGE_LOADOUT; @@ -164,6 +165,9 @@ AiL::AiL() std::string BACKDROP_CONFIG = CONFIG_PATH + "backdrop_config"_S; utils::datafile::Read(DATA,BACKDROP_CONFIG); + std::string INPUT_CONFIG = CONFIG_PATH + "input_config"_S; + utils::datafile::Read(DATA,INPUT_CONFIG); + auto keys=DATA.GetProperty("ItemConfiguration"); for(auto&[key,value]:keys){ std::string config=DATA["ItemConfiguration"][key].GetString(); @@ -2500,6 +2504,31 @@ void AiL::InitializeDefaultKeybinds(){ KEY_SCROLL.AddKeybind({ANALOG,static_cast(GPAxes::LY)}); KEY_SCROLL.AddKeybind({ANALOG,static_cast(GPAxes::RY)}); + + KEY_UNEQUIP.AddKeybind({KEY,R}); + KEY_UNEQUIP.AddKeybind({CONTROLLER,static_cast(GPButtons::FACE_U)}); + + #define TieMenuNameToGroup(KEY_NAME) \ + InputGroup::menuNamesToInputGroups[DATA["Inputs"][#KEY_NAME].GetString()]=&KEY_NAME; + + TieMenuNameToGroup(KEY_CONFIRM) + TieMenuNameToGroup(KEY_ATTACK); + TieMenuNameToGroup(KEY_LEFT); + TieMenuNameToGroup(KEY_RIGHT); + TieMenuNameToGroup(KEY_UP); + TieMenuNameToGroup(KEY_DOWN); + TieMenuNameToGroup(KEY_MENU); + TieMenuNameToGroup(KEY_BACK); + TieMenuNameToGroup(Player::KEY_ABILITY1); + TieMenuNameToGroup(Player::KEY_ABILITY2); + TieMenuNameToGroup(Player::KEY_ABILITY3); + TieMenuNameToGroup(Player::KEY_ABILITY4); + TieMenuNameToGroup(Player::KEY_DEFENSIVE); + TieMenuNameToGroup(Player::KEY_ITEM1); + TieMenuNameToGroup(Player::KEY_ITEM2); + TieMenuNameToGroup(Player::KEY_ITEM3); + + InputGroup::menuNamesToInputGroups.SetInitialized(); } void AiL::SetBossNameDisplay(std::string name,float time){ diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h index 976daa14..7ad537ed 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.h +++ b/Adventures in Lestoria/AdventuresInLestoria.h @@ -84,6 +84,7 @@ public: static InputGroup KEY_UP; static InputGroup KEY_DOWN; static InputGroup KEY_MENU; + static InputGroup KEY_UNEQUIP; static InputGroup KEY_START; static InputGroup KEY_SELECT; diff --git a/Adventures in Lestoria/C++ Header File (OLC-3).zip b/Adventures in Lestoria/C++ Header File (OLC-3).zip index 06791b1a..3328c346 100644 Binary files a/Adventures in Lestoria/C++ Header File (OLC-3).zip and b/Adventures in Lestoria/C++ Header File (OLC-3).zip differ diff --git a/Adventures in Lestoria/C++ Source File (OLC-3).zip b/Adventures in Lestoria/C++ Source File (OLC-3).zip index 30df570c..797cc85a 100644 Binary files a/Adventures in Lestoria/C++ Source File (OLC-3).zip and b/Adventures in Lestoria/C++ Source File (OLC-3).zip differ diff --git a/Adventures in Lestoria/InputControllerWindow.cpp b/Adventures in Lestoria/InputControllerWindow.cpp new file mode 100644 index 00000000..dfb120d8 --- /dev/null +++ b/Adventures in Lestoria/InputControllerWindow.cpp @@ -0,0 +1,46 @@ +#pragma region License +/* +License (OLC-3) +~~~~~~~~~~~~~~~ + +Copyright 2024 Joshua Sigona + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions or derivations of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +2. Redistributions or derivative works in binary form must reproduce the above +copyright notice. This list of conditions and the following disclaimer must be +reproduced in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may +be used to endorse or promote products derived from this software without specific +prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +Portions of this software are copyright © 2023 The FreeType +Project (www.freetype.org). Please see LICENSE_FT.txt for more information. +All rights reserved. +*/ +#pragma endregion + +#include "Menu.h" +#include "DEFINES.h" + +INCLUDE_WINDOW_SIZE + +void Menu::InitializeControllerInputWindow(){ + Menu*inputKeyboardWindow=CreateMenu(INPUT_CONTROLLER,CENTERED,WINDOW_SIZE-vf2d{28,28}); +} \ No newline at end of file diff --git a/Adventures in Lestoria/InputDisplayComponent.h b/Adventures in Lestoria/InputDisplayComponent.h new file mode 100644 index 00000000..0e24ae04 --- /dev/null +++ b/Adventures in Lestoria/InputDisplayComponent.h @@ -0,0 +1,54 @@ +#pragma region License +/* +License (OLC-3) +~~~~~~~~~~~~~~~ + +Copyright 2024 Joshua Sigona + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions or derivations of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +2. Redistributions or derivative works in binary form must reproduce the above +copyright notice. This list of conditions and the following disclaimer must be +reproduced in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may +be used to endorse or promote products derived from this software without specific +prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +Portions of this software are copyright © 2024 The FreeType +Project (www.freetype.org). Please see LICENSE_FT.txt for more information. +All rights reserved. +*/ +#pragma endregion +#pragma once + +#include "MenuComponent.h" + +class InputDisplayComponent:public MenuComponent{ + const InputGroup&input; + const InputType type; +public: + inline InputDisplayComponent(geom2d::rectpos,InputGroup&input,InputType type,MenuFunc onClick) + :MenuComponent(pos,"",onClick,ButtonAttr::NONE),input(input),type(type){} + +protected: + inline void DrawDecal(ViewPort&window,bool focused)override{ + MenuComponent::DrawDecal(window,focused); + input.DrawInput(Menu::menus[parentMenu]->pos+vf2d{rect.middle().x,rect.bottom().end.y+1},""sv,255,type); + } +}; \ No newline at end of file diff --git a/Adventures in Lestoria/InputKeyboardWindow.cpp b/Adventures in Lestoria/InputKeyboardWindow.cpp new file mode 100644 index 00000000..d465834b --- /dev/null +++ b/Adventures in Lestoria/InputKeyboardWindow.cpp @@ -0,0 +1,90 @@ +#pragma region License +/* +License (OLC-3) +~~~~~~~~~~~~~~~ + +Copyright 2024 Joshua Sigona + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions or derivations of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + +2. Redistributions or derivative works in binary form must reproduce the above +copyright notice. This list of conditions and the following disclaimer must be +reproduced in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may +be used to endorse or promote products derived from this software without specific +prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN +ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +Portions of this software are copyright © 2023 The FreeType +Project (www.freetype.org). Please see LICENSE_FT.txt for more information. +All rights reserved. +*/ +#pragma endregion + +#include "Menu.h" +#include "DEFINES.h" +#include "MenuLabel.h" +#include "Key.h" +#include "InputDisplayComponent.h" + +INCLUDE_WINDOW_SIZE + +void Menu::InitializeKeyboardInputWindow(){ + vf2d menuSize={WINDOW_SIZE.x-52.f,176.f}; + + Menu*inputKeyboardWindow=CreateMenu(INPUT_KEYBOARD,CENTERED,menuSize); + + float inputWindowWidth=menuSize.x-8; + + inputKeyboardWindow->ADD("Keyboard Mapping Label",MenuLabel)(geom2d::rect{{4,0},{menuSize.x-8.f,24.f}},"Keyboard Mappings",2.f,ComponentAttr::SHADOW|ComponentAttr::BACKGROUND|ComponentAttr::OUTLINE)END; + + inputKeyboardWindow->ADD("Menu Inputs Background",MenuLabel)(geom2d::rect{{4,28},{menuSize.x-8,56.f}},"",1.f,ComponentAttr::BACKGROUND|ComponentAttr::OUTLINE)END; + + for(int row=0;row<4;row++){ + for(int col=0;col<2;col++){ + if(col==1&&row==3)continue; + + //Exclude the very last item because we only have 9 inputs to list. + int inputID=row*2+col; + + std::string inputDisplayName="Inputs.Menu Input Names"_s[inputID]; + + inputKeyboardWindow->ADD(std::format("Input_{}_{} Background",row,col),MenuLabel)(geom2d::rect{vf2d{4,32}+vf2d{inputWindowWidth/2.f*col,row*12.f},{inputWindowWidth/4.f,11.f}},inputDisplayName,1.f,ComponentAttr::FIT_TO_LABEL|ComponentAttr::SHADOW)END; + + inputKeyboardWindow->ADD(std::format("Input_{}_{} Input Displayer",row,col),InputDisplayComponent)(geom2d::rect{vf2d{4,32}+vf2d{inputWindowWidth/2.f*col,row*12.f}+vf2d{inputWindowWidth/4.f,-1.f},vf2d{inputWindowWidth/4.f,11.f}},*InputGroup::menuNamesToInputGroups[inputDisplayName],InputType::KEY,[](MenuFuncData data){ + return true; + })END; + } + } + + inputKeyboardWindow->ADD("Controller Inputs Background",MenuLabel)(geom2d::rect{{4,100},{menuSize.x-8,68.f}},"",1.f,ComponentAttr::BACKGROUND|ComponentAttr::OUTLINE)END; + + for(int row=0;row<5;row++){ + for(int col=0;col<2;col++){ + if(col==1&&row==4)continue; + int inputID=row*2+col; + std::string inputDisplayName="Inputs.Gameplay Input Names"_s[inputID]; + + inputKeyboardWindow->ADD(std::format("GameplayInput_{}_{} Background",row,col),MenuLabel)(geom2d::rect{vf2d{4,104}+vf2d{inputWindowWidth/2.f*col,row*12.f},{inputWindowWidth/4.f,11.f}},inputDisplayName,1.f,ComponentAttr::FIT_TO_LABEL|ComponentAttr::SHADOW)END; + + inputKeyboardWindow->ADD(std::format("Input_{}_{} Gameplay Input Displayer",row,col),InputDisplayComponent)(geom2d::rect{vf2d{4,104}+vf2d{inputWindowWidth/2.f*col,row*12.f}+vf2d{inputWindowWidth/4.f,-1.f},vf2d{inputWindowWidth/4.f,11.f}},*InputGroup::menuNamesToInputGroups[inputDisplayName],InputType::KEY,[](MenuFuncData data){ + return true; + })END; + } + } +} \ No newline at end of file diff --git a/Adventures in Lestoria/Key.cpp b/Adventures in Lestoria/Key.cpp index 526ca5de..f921531c 100644 --- a/Adventures in Lestoria/Key.cpp +++ b/Adventures in Lestoria/Key.cpp @@ -45,6 +45,7 @@ INCLUDE_game INCLUDE_GFX bool Input::usingGamepad; +safemapInputGroup::menuNamesToInputGroups; Input::Input(InputType type,int key) :type(type),key(key){} @@ -241,15 +242,17 @@ std::string InputGroup::GetDisplayName(){ return combinationDisplay; } -void InputGroup::DrawInput(const vf2d pos,const std::string_view displayText,const uint8_t alpha)const{ +void InputGroup::DrawInputView(const vf2d pos,const std::string_view displayText,const uint8_t alpha,InputType type)const{ std::optionalprimaryKey; - if(Input::UsingGamepad())primaryKey=GetPrimaryKey(CONTROLLER); - else if(Menu::UsingMouseNavigation())primaryKey=GetPrimaryKey(MOUSE); - else primaryKey=GetPrimaryKey(KEY); - + switch(type){ + case CONTROLLER:primaryKey=GetPrimaryKey(CONTROLLER);break; + case MOUSE:primaryKey=GetPrimaryKey(MOUSE);break; + default:primaryKey=GetPrimaryKey(KEY);break; + } + vf2d buttonImgSize{}; std::vector>buttonImgs; - if(displayText.length()>0&&primaryKey.has_value()){ + if(primaryKey.has_value()){ if(primaryKey.value().HasIcon()){ buttonImgSize+=primaryKey.value().GetIcon().Sprite()->Size()+vf2d{"Interface.InputHelperSpacing"_F,"Interface.InputHelperSpacing"_F}; buttonImgs.push_back(primaryKey.value().GetIcon().Decal()); @@ -260,7 +263,6 @@ void InputGroup::DrawInput(const vf2d pos,const std::string_view displayText,con } vf2d descriptionTextSize=game->GetTextSizeProp(displayText); vf2d offset=-((buttonImgSize+descriptionTextSize)/2.f); - if(buttonImgs.size()!=1)ERR("WARNING! Did not have two elements when rendering input button group display! THIS SHOULD NOT BE HAPPENING!") for(auto&button:buttonImgs){ if(std::holds_alternative(button)){ Decal*img=std::get(button); @@ -285,6 +287,67 @@ void InputGroup::DrawInput(const vf2d pos,const std::string_view displayText,con } } +void InputGroup::DrawInputView(const vf2d pos,const std::string_view displayText,const uint8_t alpha)const{ + InputType primaryType; + if(Input::UsingGamepad())primaryType=CONTROLLER; + else if(Menu::UsingMouseNavigation())primaryType=MOUSE; + else primaryType=KEY; + DrawInputView(pos,displayText,alpha,primaryType); +} + +void InputGroup::DrawInput(const vf2d pos,const std::string_view displayText,const uint8_t alpha,InputType type)const{ + std::optionalprimaryKey; + switch(type){ + case CONTROLLER:primaryKey=GetPrimaryKey(CONTROLLER);break; + case MOUSE:primaryKey=GetPrimaryKey(MOUSE);break; + default:primaryKey=GetPrimaryKey(KEY);break; + } + + vf2d buttonImgSize{}; + std::vector>buttonImgs; + if(primaryKey.has_value()){ + if(primaryKey.value().HasIcon()){ + buttonImgSize+=primaryKey.value().GetIcon().Sprite()->Size()+vf2d{"Interface.InputHelperSpacing"_F,"Interface.InputHelperSpacing"_F}; + buttonImgs.push_back(primaryKey.value().GetIcon().Decal()); + }else{ + buttonImgSize+=game->GetTextSizeProp(primaryKey.value().GetDisplayName())+vf2d{"Interface.InputHelperSpacing"_F,"Interface.InputHelperSpacing"_F}; + buttonImgs.push_back(primaryKey.value().GetDisplayName()); + } + } + vf2d descriptionTextSize=game->GetTextSizeProp(displayText); + vf2d offset=-((buttonImgSize+descriptionTextSize)/2.f); + for(auto&button:buttonImgs){ + if(std::holds_alternative(button)){ + Decal*img=std::get(button); + game->view.DrawDecal(pos+offset,img,{1.f,1.f},{255,255,255,alpha}); + offset.x+=img->sprite->width+"Interface.InputHelperSpacing"_I; + }else + if(std::holds_alternative(button)){ + std::string label=std::get(button); + vf2d textSize=game->GetTextSizeProp(label); + Pixel buttonBackCol="Interface.InputButtonBackCol"_Pixel; + Pixel buttonTextCol="Interface.InputButtonTextCol"_Pixel; + buttonBackCol.a=alpha; + buttonTextCol.a=alpha; + game->FillRectDecal(pos+offset+vf2d{-2.f,0.f},vf2d{textSize.x+4,textSize.y},buttonBackCol); + game->FillRectDecal(pos+offset+vf2d{-1.f,-1.f},vf2d{textSize.x+2,textSize.y},buttonBackCol); + game->FillRectDecal(pos+offset+vf2d{-1.f,0.f},vf2d{textSize.x+2,textSize.y+1.f},buttonBackCol); + game->DrawStringPropDecal(pos+offset+vf2d{0.f,0.f},label,buttonTextCol); + offset.x+=textSize.x+"Interface.InputHelperSpacing"_I; + }else [[unlikely]]ERR("WARNING! Hit a state where no data is inside of the button! THIS SHOULD NOT BE HAPPENING!"); + + game->DrawShadowStringPropDecal(pos+offset,displayText,{255,255,255,alpha},{0,0,0,alpha}); + } +} + +void InputGroup::DrawInput(const vf2d pos,const std::string_view displayText,const uint8_t alpha)const{ + InputType primaryType; + if(Input::UsingGamepad())primaryType=CONTROLLER; + else if(Menu::UsingMouseNavigation())primaryType=MOUSE; + else primaryType=KEY; + DrawInput(pos,displayText,alpha,primaryType); +} + const bool Input::HasIcon()const{ return GenericKey::keyLiteral.at({type,key}).iconName.length()>0; } diff --git a/Adventures in Lestoria/Key.h b/Adventures in Lestoria/Key.h index 3b11b78e..c9865a98 100644 --- a/Adventures in Lestoria/Key.h +++ b/Adventures in Lestoria/Key.h @@ -40,6 +40,7 @@ All rights reserved. #include #include #include "olcPixelGameEngine.h" +#include "safemap.h" //Future-proof game controller support. enum InputType{ @@ -78,8 +79,11 @@ public: }; class InputGroup{ + friend class AiL; + friend class Menu; std::setkeys; std::vectorkeyOrder; //A list of keys inserted in order, for primary key mapping. + static safemapmenuNamesToInputGroups; public: InputGroup(); void AddKeybind(Input bind); @@ -90,7 +94,10 @@ public: const float Analog()const; std::string GetDisplayName(); //Draws an input display with accompanying text centered at given position. + void DrawInputView(const vf2d pos,const std::string_view displayText,const uint8_t alpha)const; + void DrawInputView(const vf2d pos,const std::string_view displayText,const uint8_t alpha,const InputType type)const; void DrawInput(const vf2d pos,const std::string_view displayText,const uint8_t alpha)const; + void DrawInput(const vf2d pos,const std::string_view displayText,const uint8_t alpha,const InputType type)const; const std::optionalGetPrimaryKey(InputType type)const; }; diff --git a/Adventures in Lestoria/Menu.cpp b/Adventures in Lestoria/Menu.cpp index 46325d31..ed077250 100644 --- a/Adventures in Lestoria/Menu.cpp +++ b/Adventures in Lestoria/Menu.cpp @@ -100,6 +100,8 @@ void Menu::InitializeMenus(){ InitializeUserIDWindow(); InitializeSettingsWindow(); InitializeShermanWindow(); + InitializeKeyboardInputWindow(); + InitializeControllerInputWindow(); for(MenuType type=MenuType(int(MenuType::ENUM_START)+1);typeGetTextSizeProp(m.GetName()); uint8_t alpha=uint8_t(util::lerp(0.f,255.f,m.F(A::TARGET_TIMER)/ConfigFloat("Interaction Display Ease in Timer"))); game->view.DrawShadowStringPropDecal(m.GetPos()-vf2d{0,12}-nameTextSize/2.f,m.GetName(),{255,255,0},{0,0,0}); - game->KEY_CONFIRM.DrawInput(m.GetPos()+vf2d{ConfigFloatArr("Interaction Display Offset",0),ConfigFloatArr("Interaction Display Offset",1)},"Interact",alpha); + game->KEY_CONFIRM.DrawInputView(m.GetPos()+vf2d{ConfigFloatArr("Interaction Display Offset",0),ConfigFloatArr("Interaction Display Offset",1)},"Interact",alpha); }); } m.phase=1; diff --git a/Adventures in Lestoria/SettingsWindow.cpp b/Adventures in Lestoria/SettingsWindow.cpp index 5b32e110..5f8b8514 100644 --- a/Adventures in Lestoria/SettingsWindow.cpp +++ b/Adventures in Lestoria/SettingsWindow.cpp @@ -93,8 +93,8 @@ void Menu::InitializeSettingsWindow(){ },false)END; settingsWindow->ADD("Keyboard Play Auto-Aim Label",MenuLabel)(geom2d::rect{{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; - settingsWindow->ADD("Keyboard Bindings Label",MenuComponent)(geom2d::rect{{28,132.f},vf2d{windowSize.x-32,24}},"Keyboard Bindings",MenuType::ENUM_END,DO_NOTHING,vf2d{1.5f,2.f})END; - settingsWindow->ADD("Controller Bindings Label",MenuComponent)(geom2d::rect{{28,160.f},vf2d{windowSize.x-32,24}},"Controller Bindings",MenuType::ENUM_END,DO_NOTHING,vf2d{1.5f,2.f})END; + settingsWindow->ADD("Keyboard Bindings Label",MenuComponent)(geom2d::rect{{28,132.f},vf2d{windowSize.x-32,24}},"Keyboard Bindings",MenuType::INPUT_KEYBOARD,DO_NOTHING,vf2d{1.5f,2.f})END; + settingsWindow->ADD("Controller Bindings Label",MenuComponent)(geom2d::rect{{28,160.f},vf2d{windowSize.x-32,24}},"Controller Bindings",MenuType::INPUT_CONTROLLER,DO_NOTHING,vf2d{1.5f,2.f})END; settingsWindow->ADD("Go Back",MenuComponent)(geom2d::rect{vf2d{windowSize.x/2.f,windowSize.y}-vf2d{36,16},{72,12}},"Go Back",[](MenuFuncData data){ Menu::CloseMenu(); diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index 9e8b28ed..9d39236c 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -11,6 +11,21 @@ Settings Menu remove that bind from the list. Up to two keys may be binded per action. -We have to save keybinds to the save file. + Menu Inputs + - Confirm + - Back + - Menu + - Change Loadout (Overworld Map) + - Unequip + - Left + - Right + - Up + - Down + + Gameplay Inputs + - Ability 1,2,3,4 + - Item 1,2,3 + - Basic Attack - XP Bar diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 872be750..4ca26078 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 3 #define VERSION_PATCH 0 -#define VERSION_BUILD 6753 +#define VERSION_BUILD 6784 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/configuration.txt b/Adventures in Lestoria/assets/config/configuration.txt index 24c8161b..c516f0ad 100644 --- a/Adventures in Lestoria/assets/config/configuration.txt +++ b/Adventures in Lestoria/assets/config/configuration.txt @@ -83,6 +83,9 @@ event_config = audio/events.txt # Path to interface configuration interface_config = Interface.txt +# Path to Keyboard Input configuration +input_config = settings/input.txt + # Path to character images character_image_location = characters/commercial_assets/ diff --git a/Adventures in Lestoria/assets/config/settings/input.txt b/Adventures in Lestoria/assets/config/settings/input.txt new file mode 100644 index 00000000..f63bb5a7 --- /dev/null +++ b/Adventures in Lestoria/assets/config/settings/input.txt @@ -0,0 +1,25 @@ +Inputs +{ + Menu Input Names = Confirm, Back, Menu, Up, Right, Down, Left + + Gameplay Input Names = Basic Attack, Ability 1, Ability 2, Ability 3, Ability 4, Defensive, Item 1, Item 2, Item 3 + + + KEY_CONFIRM = Confirm + KEY_ATTACK = Basic Attack + + KEY_LEFT=Left + KEY_RIGHT=Right + KEY_UP=Up + KEY_DOWN=Down + KEY_MENU=Menu + KEY_BACK=Back + Player::KEY_ABILITY1=Ability 1 + Player::KEY_ABILITY2=Ability 2 + Player::KEY_ABILITY3=Ability 3 + Player::KEY_ABILITY4=Ability 4 + Player::KEY_DEFENSIVE=Defensive + Player::KEY_ITEM1=Item 1 + Player::KEY_ITEM2=Item 2 + Player::KEY_ITEM3=Item 3 +} \ No newline at end of file diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 09f79be8..cb5d7781 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ