diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj
index 831304d7..bbb35967 100644
--- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj
+++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj
@@ -163,7 +163,7 @@
true
stdcpp20
C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria\discord-files;C:\Users\sigon\OneDrive\Documents\include;%(AdditionalIncludeDirectories)
- /MP8 %(AdditionalOptions)
+ /MP20 %(AdditionalOptions)
4099;5030;4715;4172;4834
@@ -189,7 +189,7 @@
NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
stdcpp20
- /MP8 %(AdditionalOptions)
+ /MP20 %(AdditionalOptions)
C:\Users\sigon\source\repos\AdventuresInLestoria\Adventures in Lestoria\discord-files;C:\Users\sigon\OneDrive\Documents\include
diff --git a/Adventures in Lestoria/Checkbox.h b/Adventures in Lestoria/Checkbox.h
index 04454ccd..89bba065 100644
--- a/Adventures in Lestoria/Checkbox.h
+++ b/Adventures in Lestoria/Checkbox.h
@@ -63,6 +63,10 @@ public:
return checked;
}
+ inline void SetChecked(bool checked){
+ this->checked=checked;
+ }
+
inline void DrawDecal(ViewPort&window,bool focused)override{
geom2d::linecheckmarkLine1=geom2d::line({rect.left().start.x+rect.size.x*0.125f,rect.left().start.y+rect.size.y*0.5f},{rect.top().start.x+rect.size.x*0.375f,rect.top().start.y+rect.size.y*0.875f});
geom2d::linecheckmarkLine2=geom2d::line(checkmarkLine1.end,{rect.left().start.x+rect.size.x*0.875f,rect.top().start.y+rect.size.y*0.25f});
diff --git a/Adventures in Lestoria/InputDisplayComponent.h b/Adventures in Lestoria/InputDisplayComponent.h
index c29fde9f..123c466e 100644
--- a/Adventures in Lestoria/InputDisplayComponent.h
+++ b/Adventures in Lestoria/InputDisplayComponent.h
@@ -48,6 +48,9 @@ public:
inline void SetKeyType(const InputType type){
this->type=type;
}
+ inline const InputType GetType()const{
+ return type;
+ }
protected:
inline void DrawDecal(ViewPort&window,bool focused)override{
MenuComponent::DrawDecal(window,focused);
diff --git a/Adventures in Lestoria/InputKeyboardWindow.cpp b/Adventures in Lestoria/InputKeyboardWindow.cpp
index f790b3af..2d3da289 100644
--- a/Adventures in Lestoria/InputKeyboardWindow.cpp
+++ b/Adventures in Lestoria/InputKeyboardWindow.cpp
@@ -41,6 +41,7 @@ All rights reserved.
#include "MenuLabel.h"
#include "Key.h"
#include "InputDisplayComponent.h"
+#include "olcPGEX_Gamepad.h"
using A=Attribute;
@@ -72,10 +73,16 @@ void Menu::InitializeKeyboardInputWindow(){
inputKeyboardWindow->ADD(std::format("Input_{}_{} Background",row,col),MenuLabel)(geom2d::rect{vf2d{4,36}+vf2d{inputWindowWidth/2.f*col,row*12.f},{inputWindowWidth/4.f,11.f}},inputDisplayName,1.f,ComponentAttr::FIT_TO_LABEL|ComponentAttr::SHADOW)END;
auto inputChangeButton=inputKeyboardWindow->ADD(std::format("Input_{}_{} Input Displayer",row,col),InputDisplayComponent)(geom2d::rect{vf2d{4,36}+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){
- Menu::menus[NEW_INPUT]->B(A::IS_KEYBOARD)=true;
+ Menu::menus[NEW_INPUT]->B(A::IS_KEYBOARD)=DYNAMIC_POINTER_CAST(data.component)->GetType()==InputType::KEY;
std::string keybindName=data.component.lock()->S(A::KEYBIND);
Menu::menus[NEW_INPUT]->S(A::KEYBIND)=keybindName;
- Component(NEW_INPUT,"New Keybind Label")->SetLabel(std::format("Press a new key for '{}'\n\nPress Esc to cancel.",keybindName));
+ std::string cancelButtonDisplayName=GenericKey::keyLiteral[{KEY,ESCAPE}].displayName;
+ std::string keyTypeName="key";
+ if(!Menu::menus[NEW_INPUT]->B(A::IS_KEYBOARD)){ //Check if this is for a controller instead.
+ cancelButtonDisplayName=GenericKey::keyLiteral[{CONTROLLER,static_cast(GPButtons::SELECT)}].displayName;
+ keyTypeName="button";
+ }
+ Component(NEW_INPUT,"New Keybind Label")->SetLabel(std::format("Press a new {} for '{}'\n\nPress {} to cancel.",keyTypeName,keybindName,cancelButtonDisplayName));
Menu::OpenMenu(NEW_INPUT);
return true;
})END;
@@ -97,10 +104,16 @@ void Menu::InitializeKeyboardInputWindow(){
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;
auto inputChangeButton=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){
- Menu::menus[NEW_INPUT]->B(A::IS_KEYBOARD)=true;
+ Menu::menus[NEW_INPUT]->B(A::IS_KEYBOARD)=DYNAMIC_POINTER_CAST(data.component)->GetType()==InputType::KEY;
std::string keybindName=data.component.lock()->S(A::KEYBIND);
Menu::menus[NEW_INPUT]->S(A::KEYBIND)=keybindName;
- Component(NEW_INPUT,"New Keybind Label")->SetLabel(std::format("Press a new key for '{}'\n\nPress Esc to cancel.",keybindName));
+ std::string cancelButtonDisplayName=GenericKey::keyLiteral[{KEY,ESCAPE}].displayName;
+ std::string keyTypeName="key";
+ if(!Menu::menus[NEW_INPUT]->B(A::IS_KEYBOARD)){ //Check if this is for a controller instead.
+ cancelButtonDisplayName=GenericKey::keyLiteral[{CONTROLLER,static_cast(GPButtons::SELECT)}].displayName;
+ keyTypeName="button";
+ }
+ Component(NEW_INPUT,"New Keybind Label")->SetLabel(std::format("Press a new {} for '{}'\n\nPress {} to cancel.",keyTypeName,keybindName,cancelButtonDisplayName));
Menu::OpenMenu(NEW_INPUT);
return true;
})END;
diff --git a/Adventures in Lestoria/Key.cpp b/Adventures in Lestoria/Key.cpp
index 0997b16c..4f00c0a6 100644
--- a/Adventures in Lestoria/Key.cpp
+++ b/Adventures in Lestoria/Key.cpp
@@ -266,7 +266,17 @@ void InputGroup::DrawInput(const std::variant(button)){
Decal*img=std::get(button);
- game->view.DrawDecal(pos+offset,img,{1.f,1.f},{255,255,255,alpha});
+
+ #pragma region Render Macro
+ #define Render(rendererType) \
+ std::get(renderer)->DrawDecal(pos+offset,img,{1.f,1.f},{255,255,255,alpha});
+ #pragma endregion
+ if(std::holds_alternative(renderer)){
+ Render(AiL);
+ }else
+ if(std::holds_alternative(renderer)){
+ Render(TileTransformedView);
+ }
offset.x+=img->sprite->width+"Interface.InputHelperSpacing"_I;
}else
if(std::holds_alternative(button)){
@@ -564,7 +574,7 @@ void InputListener::Update(){
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(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;
diff --git a/Adventures in Lestoria/SaveFile.cpp b/Adventures in Lestoria/SaveFile.cpp
index e5c9e2d5..e7c40f20 100644
--- a/Adventures in Lestoria/SaveFile.cpp
+++ b/Adventures in Lestoria/SaveFile.cpp
@@ -45,6 +45,7 @@ All rights reserved.
#include "ClassInfo.h"
#include "ScrollableWindowComponent.h"
#include "LoadFileButton.h"
+#include "Checkbox.h"
INCLUDE_game
@@ -318,7 +319,9 @@ const void SaveFile::SetSaveFileOfflineID_TransitionToOverworldMap(){
SaveFile::saveFileID=saveFileCount;
GameState::ChangeState(States::OVERWORLD_MAP);
},[](void*arg){
- std::cout<<"Failed to load metadata!"<afterSaveGameDataUp
SaveFile::afterSaveGameDataUpdate();
},[](void*arg){
std::cout<<"Failed to load metadata!"<(CLASS_SELECTION,"Online Character Checkbox")->SetChecked(onlineMode);
}
\ No newline at end of file
diff --git a/Adventures in Lestoria/SettingsWindow.cpp b/Adventures in Lestoria/SettingsWindow.cpp
index 64f87ed0..16cccb86 100644
--- a/Adventures in Lestoria/SettingsWindow.cpp
+++ b/Adventures in Lestoria/SettingsWindow.cpp
@@ -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{{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 Button",MenuComponent)(geom2d::rect{{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{{28,160.f},vf2d{windowSize.x-32,24}},"Controller Bindings",MenuType::INPUT_KEY_DISPLAY,DO_NOTHING,vf2d{1.5f,2.f})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(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(INPUT_KEY_DISPLAY,std::format("Input_{}_{} Gameplay Input Displayer",row,col))->SetKeyType(inputType);
+ }
+ }
+ };
+ #pragma endregion
+
+ settingsWindow->ADD("Keyboard Bindings Button",MenuComponent)(geom2d::rect{{28,132.f},vf2d{windowSize.x-32,24}},"Keyboard Bindings",MenuType::ENUM_END,[&](MenuFuncData data){
+ ChangeKeybindDisplayType(KEY);
+ Component(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{{28,160.f},vf2d{windowSize.x-32,24}},"Controller Bindings",MenuType::ENUM_END,[&](MenuFuncData data){
+ ChangeKeybindDisplayType(CONTROLLER);
+ Component(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{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 404142bb..bc09d549 100644
--- a/Adventures in Lestoria/TODO.txt
+++ b/Adventures in Lestoria/TODO.txt
@@ -62,3 +62,5 @@ Story proofreading/correcting/storyboarding
- Icon displays / Proper key displays above skill keys
- Auto aim causes retreat-type moves to aim away from the auto target, and prefer the direction the player's moving in.
+
+- Save window position and size
\ No newline at end of file
diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h
index a0711560..c1797dda 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 6859
+#define VERSION_BUILD 6866
#define stringify(a) stringify_(a)
#define stringify_(a) #a
diff --git a/Adventures in Lestoria/olcPGEX_Gamepad.h b/Adventures in Lestoria/olcPGEX_Gamepad.h
index 2e16383a..aa6a68f1 100644
--- a/Adventures in Lestoria/olcPGEX_Gamepad.h
+++ b/Adventures in Lestoria/olcPGEX_Gamepad.h
@@ -234,9 +234,14 @@ namespace olc {
float axes[GP_AXIS_COUNT]{0};
olc::HWButton buttons[GP_BUTTON_COUNT];
bool ff = false;
+#ifdef __EMSCRIPTEN__
+ public:
+#endif
bool availableButtons[GP_BUTTON_COUNT] = {false};
bool availableAxes[GP_AXIS_COUNT] = {false};
-
+#ifdef __EMSCRIPTEN__
+ private:
+#endif
float deadZone=0.2f;
float deadZoneOuter=0.2f;
diff --git a/emscripten_build.ps1 b/emscripten_build.ps1
index 23da8e7f..0b964084 100755
--- a/emscripten_build.ps1
+++ b/emscripten_build.ps1
@@ -1,3 +1,3 @@
clear
emcmake cmake -DCMAKE_BUILD_TYPE=Release .
-cmake --build . -j 8
\ No newline at end of file
+cmake --build . -j 20
\ No newline at end of file
diff --git a/emscripten_debug_build.ps1 b/emscripten_debug_build.ps1
index 1892785d..ee8ab40f 100644
--- a/emscripten_debug_build.ps1
+++ b/emscripten_debug_build.ps1
@@ -1,3 +1,3 @@
clear
emcmake cmake -DCMAKE_BUILD_TYPE=Debug -D_DEBUG=1 .
-cmake --build . -j 8
\ No newline at end of file
+cmake --build . -j 20
\ No newline at end of file
diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe
index db4287b8..c4e1760d 100644
Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ