From 15990152c7d6c8d74d87c572b9463de73f4e9aa3 Mon Sep 17 00:00:00 2001 From: sigonasr2 Date: Sat, 27 Jan 2024 06:43:09 -0600 Subject: [PATCH] Added character name input to class selection window, removed "file save name" dialog from main menu navigation. Fixed scaling for button labels with different values than 1. Moved ScrollableWindowComponent's scrollbar to be lined up with the actual scrollbar arrows. Removed text entry mode from blocking controller / gamepad inputs. --- .../Adventures in Lestoria.vcxproj | 4 ++ .../Adventures in Lestoria.vcxproj.filters | 3 ++ .../AdventuresInLestoria.cpp | 1 - .../ClassSelectionWindow.cpp | 25 ++++++--- Adventures in Lestoria/LoadFileButton.h | 12 ++++- Adventures in Lestoria/LoadGameWindow.cpp | 4 +- Adventures in Lestoria/MainMenuWindow.cpp | 17 +++--- Adventures in Lestoria/Menu.cpp | 26 ++++----- Adventures in Lestoria/MenuComponent.cpp | 3 +- Adventures in Lestoria/SaveFile.cpp | 2 +- Adventures in Lestoria/SaveFileNameButton.h | 53 +++++++++++++++++++ Adventures in Lestoria/SaveFileWindow.cpp | 18 ++----- .../ScrollableWindowComponent.h | 4 +- Adventures in Lestoria/TextEntryLabel.h | 6 +++ Adventures in Lestoria/Version.h | 2 +- .../assets/config/Player.txt | 6 +++ Adventures in Lestoria/olcPixelGameEngine.h | 7 +++ 17 files changed, 137 insertions(+), 56 deletions(-) create mode 100644 Adventures in Lestoria/SaveFileNameButton.h diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj index 797bce80..77a0f5ae 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj @@ -526,6 +526,10 @@ + + + + diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters index 61c6d975..fa74026c 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters @@ -441,6 +441,9 @@ Header Files + + Header Files\Interface + diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 77e13220..32aaa5a0 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -2413,7 +2413,6 @@ void AiL::InitializeDefaultKeybinds(){ KEY_CONFIRM.AddKeybind({CONTROLLER,static_cast(GPButtons::FACE_R)}); //KEY_CONFIRM.AddKeybind({CONTROLLER,static_cast(GPButtons::START)}); KEY_CONFIRM.AddKeybind({KEY,Z}); - KEY_CONFIRM.AddKeybind({KEY,SPACE}); KEY_CONFIRM.AddKeybind({KEY,ENTER}); KEY_BACK.AddKeybind({KEY,X}); KEY_BACK.AddKeybind({KEY,SHIFT}); diff --git a/Adventures in Lestoria/ClassSelectionWindow.cpp b/Adventures in Lestoria/ClassSelectionWindow.cpp index 147ad248..3f5fbd7e 100644 --- a/Adventures in Lestoria/ClassSelectionWindow.cpp +++ b/Adventures in Lestoria/ClassSelectionWindow.cpp @@ -42,24 +42,37 @@ All rights reserved. #include "MenuAnimatedIconToggleButton.h" #include "GameState.h" #include "ClassInfo.h" +#include "SaveFileNameButton.h" +#include "TextEntryLabel.h" INCLUDE_game using A=Attribute; void Menu::InitializeClassSelectionWindow(){ - Menu*classSelectionWindow=CreateMenu(CLASS_SELECTION,CENTERED,game->GetScreenSize()-vi2d{24,24}); + vf2d windowSize=game->GetScreenSize()-vi2d{24,8}; + + Menu*classSelectionWindow=CreateMenu(CLASS_SELECTION,CENTERED,windowSize); classSelectionWindow->S(A::CLASS_SELECTION)="Warrior"; //Default selected class. - vf2d outlineSize=classSelectionWindow->size-vf2d{13,13}; + vf2d outlineSize=classSelectionWindow->size-vf2d{8,29}; + + classSelectionWindow->ADD("Class Selection Title Label",MenuLabel)(geom2d::rect{{4,12},{outlineSize.x,32}},"Choose a Character Class",2,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END; - classSelectionWindow->ADD("Class Selection Title Label",MenuLabel)(geom2d::rect{{4,20},{outlineSize.x,32}},"Choose a Character Class",2,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END; + auto outline=classSelectionWindow->ADD("Outline Border",MenuLabel)(geom2d::rect{{4,4},outlineSize+vf2d{0,25}},"",1,ComponentAttr::OUTLINE)END; - auto outline=classSelectionWindow->ADD("Outline Border",MenuLabel)(geom2d::rect{{4,4},outlineSize},"",1,ComponentAttr::OUTLINE)END; + classSelectionWindow->ADD("Character Name Label",MenuLabel)(geom2d::rect{{windowSize.x/2-144.f,60.f},{96.f,24.f}},"Name:",2.0f,ComponentAttr::BACKGROUND|ComponentAttr::OUTLINE|ComponentAttr::SHADOW)END; + + classSelectionWindow->ADD("Character Name Box",SaveFileNameButton)(geom2d::rect{{windowSize.x/2-48.f,60.f},{192.f,24}},[&](MenuFuncData data){ + Component(SAVE_FILE_NAME,"Save File Name Text Entry")->SetInput(std::string(SaveFile::GetSaveFileName())); + game->TextEntryEnable(true); + Menu::OpenMenu(SAVE_FILE_NAME); + return true; + },vf2d{2.f,2.f})END; vf2d navigationButtonSize={24*2.5f,16}; - classSelectionWindow->ADD("Confirm",MenuComponent)(geom2d::rect{{outlineSize.x+4-navigationButtonSize.x-2,outlineSize.y+4-navigationButtonSize.y-2},navigationButtonSize},"Confirm",[](MenuFuncData data){ + classSelectionWindow->ADD("Confirm",MenuComponent)(geom2d::rect{{outlineSize.x+4-navigationButtonSize.x-2,outlineSize.y+29-navigationButtonSize.y-2},navigationButtonSize},"Confirm",[](MenuFuncData data){ std::string selectedClass=data.component.lock()->S(A::CLASS_SELECTION); data.game->ChangePlayerClass(classutils::StringToClass(selectedClass)); GameState::ChangeState(States::OVERWORLD_MAP); @@ -72,7 +85,7 @@ void Menu::InitializeClassSelectionWindow(){ float buttonTotalWidth=(buttonSize.x+buttonPadding.x)*3; - vf2d buttonStartPos=outline->GetPos()+vf2d{outlineSize.x/2,outlineSize.y/3}-vf2d{buttonTotalWidth/2,0}; + vf2d buttonStartPos=outline->GetPos()+vf2d{outlineSize.x/2,outlineSize.y/3}-vf2d{buttonTotalWidth/2,0}+vf2d{0,24}; std::arrayclassNames={ Warrior::name, diff --git a/Adventures in Lestoria/LoadFileButton.h b/Adventures in Lestoria/LoadFileButton.h index eda20a27..98ab7ed6 100644 --- a/Adventures in Lestoria/LoadFileButton.h +++ b/Adventures in Lestoria/LoadFileButton.h @@ -70,8 +70,6 @@ public: if(playTime==-1){ window.DrawShadowStringPropDecal(rect.pos+vf2d{2,2},"UNKNOWN"); }else{ - window.DrawShadowStringPropDecal(rect.pos+vf2d{2,2},saveFileName); - const std::mapclassAnimations={ {Warrior::name,Warrior::walk_s}, {Ranger::name,Ranger::walk_s}, @@ -85,6 +83,16 @@ public: vf2d chapterTextSize=game->GetTextSize(chapterText); window.DrawShadowStringDecal(rect.pos+vf2d{rect.size.x-chapterTextSize.x-2,2},chapterText); + + vf2d saveFileNameSize=game->GetTextSizeProp(saveFileName); + float spaceAvailable=rect.size.x-chapterTextSize.x-8; + float scaleRatio=1.f; + if(saveFileNameSize.x>spaceAvailable){ + scaleRatio=spaceAvailable/saveFileNameSize.x; + } + + window.DrawShadowStringPropDecal(rect.pos+vf2d{2,2},saveFileName,WHITE,BLACK,vf2d{scaleRatio,1.f}); + const Animate2D::Frame&frame=ANIMATION_DATA[classAnimations.at(className)].GetFrame(animationTime); geom2d::rectsprRect=frame.GetSourceRect(); window.DrawPartialDecal(rect.pos+vf2d{rect.size.x-26,rect.size.y-36},sprRect.size,frame.GetSourceImage()->Decal(),sprRect.pos,sprRect.size); diff --git a/Adventures in Lestoria/LoadGameWindow.cpp b/Adventures in Lestoria/LoadGameWindow.cpp index aa578d0a..a5cea7c8 100644 --- a/Adventures in Lestoria/LoadGameWindow.cpp +++ b/Adventures in Lestoria/LoadGameWindow.cpp @@ -45,9 +45,9 @@ void Menu::InitializeLoadGameWindow(){ loadGameWindow->ADD("Game Files Label",MenuLabel)(geom2d::rect{{-8,-12},{112,12}},"Load Game",1.0f,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END; loadGameWindow->ADD("Game Files List",ScrollableWindowComponent)(geom2d::rect{{-8,4},{112,116}})END - ->Enable(false); - loadGameWindow->ADD("Online Game Files List",ScrollableWindowComponent)(geom2d::rect{{-8,4},{112,116}})END ->Enable(true); + loadGameWindow->ADD("Online Game Files List",ScrollableWindowComponent)(geom2d::rect{{-8,4},{112,116}})END + ->Enable(false); loadGameWindow->ADD("Go Back Button",MenuComponent)(geom2d::rect{{24,124},{48,12}},"Back",[](MenuFuncData menu){Menu::CloseMenu();return true;})END; diff --git a/Adventures in Lestoria/MainMenuWindow.cpp b/Adventures in Lestoria/MainMenuWindow.cpp index 71f5a048..0b63502b 100644 --- a/Adventures in Lestoria/MainMenuWindow.cpp +++ b/Adventures in Lestoria/MainMenuWindow.cpp @@ -40,25 +40,20 @@ All rights reserved. #include "Menu.h" #include "MenuComponent.h" #include "SaveFile.h" +#include "util.h" INCLUDE_game +INCLUDE_DATA using A=Attribute; void Menu::InitializeMainMenuWindow(){ Menu*mainMenuWindow=CreateMenu(MAIN_MENU,vi2d{132,120},vi2d{96,96}); auto newGameButton=mainMenuWindow->ADD("New Game Button",MenuComponent)(geom2d::rect{{12,4},{72,24}},"New Game",[&](MenuFuncData data){ - game->TextEntryEnable(true); - #ifdef __EMSCRIPTEN__ - data.menu.S(A::NEXT_MENU)="New Game"; - if(SaveFile::GetUserID().length()==0){ - Menu::OpenMenu(USER_ID); - }else{ - Menu::OpenMenu(SAVE_FILE_NAME); - } - #else - Menu::OpenMenu(SAVE_FILE_NAME); - #endif + std::string randomName=DATA["Player"]["Default Female Name"].GetString(util::random()%DATA["Player"]["Default Female Name"].GetValueCount()); + + SaveFile::SetSaveFileName(randomName); //Randomize a default name. + Menu::OpenMenu(CLASS_SELECTION); return true; })END; auto loadGameButton=mainMenuWindow->ADD("Load Game Button",MenuComponent)(geom2d::rect{{12,36},{72,24}},"Load Game",[](MenuFuncData data){ diff --git a/Adventures in Lestoria/Menu.cpp b/Adventures in Lestoria/Menu.cpp index 9749a38a..a90a050f 100644 --- a/Adventures in Lestoria/Menu.cpp +++ b/Adventures in Lestoria/Menu.cpp @@ -171,11 +171,9 @@ void Menu::Update(AiL*game){ bool itemHovered=false; if(!UsingMouseNavigation()){ - if(!game->IsTextEntryEnabled()){ - if(!selection.expired()){ - selection.lock()->hovered=true; - itemHovered=true; - } + if(!selection.expired()){ + selection.lock()->hovered=true; + itemHovered=true; } }else{ selection={}; @@ -204,14 +202,12 @@ void Menu::Update(AiL*game){ }; if(!UsingMouseNavigation()){ - if(!game->IsTextEntryEnabled()){ - if(game->KEY_CONFIRM.Released()){ - if(selection.expired()){//Dropping over an empty area. - ClearDraggingComponent(); - }else - if(selection.lock()->DropDraggableItem(std::move(draggingComponent))){ - ClearDraggingComponent(); - } + if(game->KEY_CONFIRM.Released()){ + if(selection.expired()){//Dropping over an empty area. + ClearDraggingComponent(); + }else + if(selection.lock()->DropDraggableItem(std::move(draggingComponent))){ + ClearDraggingComponent(); } } }else{ @@ -226,9 +222,7 @@ void Menu::Update(AiL*game){ } } - if(!game->IsTextEntryEnabled()){ - KeyboardButtonNavigation(game,pos); - } + KeyboardButtonNavigation(game,pos); for(auto&[key,component]:components){ if(component->renderInMain){ diff --git a/Adventures in Lestoria/MenuComponent.cpp b/Adventures in Lestoria/MenuComponent.cpp index 3bcce5d7..331f3ad0 100644 --- a/Adventures in Lestoria/MenuComponent.cpp +++ b/Adventures in Lestoria/MenuComponent.cpp @@ -109,9 +109,10 @@ void MenuComponent::DrawDecal(ViewPort&window,bool focused){ vi2d labelTextSize=vf2d(game->GetTextSizeProp(label))*adjustedScale; if(fitToLabel){ - float sizeRatio=((vf2d(labelTextSize)*adjustedScale).x)/(rect.size.x-2); + float sizeRatio=(vf2d(labelTextSize).x)/(rect.size.x-2); if(sizeRatio>1){ adjustedScale.x/=sizeRatio; + labelTextSize.x/=sizeRatio; } } window.DrawStringPropDecal(rect.pos+V(A::DRAW_OFFSET)+rect.size/2-vf2d(labelTextSize)/2.f,label,WHITE,adjustedScale); diff --git a/Adventures in Lestoria/SaveFile.cpp b/Adventures in Lestoria/SaveFile.cpp index 2821f13d..b39d4ad1 100644 --- a/Adventures in Lestoria/SaveFile.cpp +++ b/Adventures in Lestoria/SaveFile.cpp @@ -51,7 +51,7 @@ INCLUDE_game size_t SaveFile::saveFileID=0; std::string SaveFile::saveFileName=""; std::string SaveFile::username=""; -bool SaveFile::onlineMode=true; +bool SaveFile::onlineMode=false; const size_t SaveFile::GetSaveFileCount(){ std::filesystem::create_directories("save_file_path"_S); diff --git a/Adventures in Lestoria/SaveFileNameButton.h b/Adventures in Lestoria/SaveFileNameButton.h new file mode 100644 index 00000000..44960923 --- /dev/null +++ b/Adventures in Lestoria/SaveFileNameButton.h @@ -0,0 +1,53 @@ +#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 +#pragma once + +#include "MenuComponent.h" +#include "SaveFile.h" + +class SaveFileNameButton:public MenuComponent{ +public: + inline SaveFileNameButton(geom2d::rectrect,MenuFunc onClick,vf2d labelScaling,ButtonAttr attributes=ButtonAttr::FIT_TO_LABEL) + :MenuComponent(rect,"",MenuType::ENUM_END,onClick,labelScaling,attributes){} + + inline void Update(AiL*game)override{ + MenuComponent::Update(game); + + label=SaveFile::GetSaveFileName(); + } +}; \ No newline at end of file diff --git a/Adventures in Lestoria/SaveFileWindow.cpp b/Adventures in Lestoria/SaveFileWindow.cpp index 726f3849..316a046e 100644 --- a/Adventures in Lestoria/SaveFileWindow.cpp +++ b/Adventures in Lestoria/SaveFileWindow.cpp @@ -42,12 +42,12 @@ All rights reserved. void Menu::InitializeSaveFileWindow(){ Menu*saveFileWindow=CreateMenu(SAVE_FILE_NAME,CENTERED,vi2d{96,96}); - saveFileWindow->ADD("Save File Name Entry Label",MenuLabel)(geom2d::rect{{-8,0},{112,36}},"Save File Name:",1.0f,ComponentAttr::SHADOW)END; + saveFileWindow->ADD("Save File Name Entry Label",MenuLabel)(geom2d::rect{{-8,0},{112,36}},"Character Name:",1.0f,ComponentAttr::SHADOW)END; saveFileWindow->ADD("Save File Name Text Entry",TextEntryLabel)(geom2d::rect{{-8,36},{112,24}},[](std::string_view updatedLabel){ Component(SAVE_FILE_NAME,"Continue Button")->SetGrayedOut(updatedLabel.length()==0); },false,16U,2.f,ComponentAttr::FIT_TO_LABEL|ComponentAttr::OUTLINE|ComponentAttr::SHADOW|ComponentAttr::BACKGROUND)END; - saveFileWindow->ADD("Back Button",MenuComponent)(geom2d::rect{{-8,68},{48,12}},"Back",[](MenuFuncData data){Menu::CloseMenu();game->TextEntryEnable(false);return true;})END; - saveFileWindow->ADD("Continue Button",MenuComponent)(geom2d::rect{{56,68},{48,12}},"Begin",MenuType::CLASS_SELECTION,[](MenuFuncData data){ + saveFileWindow->ADD("Back Button",MenuComponent)(geom2d::rect{{-8,68},{48,12}},"Cancel",[](MenuFuncData data){Menu::CloseMenu();game->TextEntryEnable(false);return true;})END; + saveFileWindow->ADD("Continue Button",MenuComponent)(geom2d::rect{{56,68},{48,12}},"Submit",MenuType::CLASS_SELECTION,[](MenuFuncData data){ SaveFile::SetSaveFileName(game->TextEntryGetString()); if(SaveFile::IsOnline()){ SaveFile::SetSaveFileID(SaveFile::GetOnlineSaveFileCount()); @@ -55,7 +55,6 @@ void Menu::InitializeSaveFileWindow(){ SaveFile::SetSaveFileID(SaveFile::GetSaveFileCount()); } game->TextEntryEnable(false); - SaveFile::SaveGame(); return true; })END ->SetGrayedOut(true); @@ -72,13 +71,6 @@ void Menu::InitializeSaveFileWindow(){ {game->KEY_SELECT,{"Return to Title Screen",[](MenuType type){ Component(type,"Back Button")->Click(); }}}, - } - ,{ //Button Navigation Rules - {"Continue Button",{ - .left="Back Button", - .right="Back Button",}}, - {"Back Button",{ - .left="Continue Button", - .right="Continue Button",}}, - }); + }, + {}); } \ No newline at end of file diff --git a/Adventures in Lestoria/ScrollableWindowComponent.h b/Adventures in Lestoria/ScrollableWindowComponent.h index 106cf39b..22c39db6 100644 --- a/Adventures in Lestoria/ScrollableWindowComponent.h +++ b/Adventures in Lestoria/ScrollableWindowComponent.h @@ -229,8 +229,8 @@ protected: float focusedWindowColorMult=(focused?1:"ThemeGlobal.MenuUnfocusedColorMult"_F); - window.FillRectDecal(rect.pos+parentPos+vf2d{rect.size.x-11.75f,scrollBarTop+12},{12,scrollBarHeight},PixelLerp(Menu::GetCurrentTheme().GetButtonCol(),Menu::GetCurrentTheme().GetHighlightCol(),scrollBarHoverTime/"ThemeGlobal.HighlightTime"_F)*focusedWindowColorMult); - window.DrawRectDecal(rect.pos+parentPos+vf2d{rect.size.x-11.75f,scrollBarTop+12},{12,scrollBarHeight},WHITE*focusedWindowColorMult); + window.FillRectDecal(rect.pos+parentPos+vf2d{rect.size.x-12.f,scrollBarTop+12},{12,scrollBarHeight},PixelLerp(Menu::GetCurrentTheme().GetButtonCol(),Menu::GetCurrentTheme().GetHighlightCol(),scrollBarHoverTime/"ThemeGlobal.HighlightTime"_F)*focusedWindowColorMult); + window.DrawRectDecal(rect.pos+parentPos+vf2d{rect.size.x-12.f,scrollBarTop+12},{12,scrollBarHeight},WHITE*focusedWindowColorMult); } inline float GetComponentIndex(std::weak_ptrcomp){ diff --git a/Adventures in Lestoria/TextEntryLabel.h b/Adventures in Lestoria/TextEntryLabel.h index 90668215..92a9f890 100644 --- a/Adventures in Lestoria/TextEntryLabel.h +++ b/Adventures in Lestoria/TextEntryLabel.h @@ -77,6 +77,12 @@ public: } } + inline virtual void SetInput(std::string text){ + game->TextEntrySetString(text); + label=text; + if(runOnLabelChangeFunc)onLabelChangeFunc(text); + } + inline const std::string&GetLabel()const override{ if(censored){ return game->TextEntryGetString(); diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 354c2a0e..e0993a9c 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 6402 +#define VERSION_BUILD 6436 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/Player.txt b/Adventures in Lestoria/assets/config/Player.txt index 61c6f026..4dd166a4 100644 --- a/Adventures in Lestoria/assets/config/Player.txt +++ b/Adventures in Lestoria/assets/config/Player.txt @@ -11,6 +11,12 @@ Player Starting Money = 100 + # A default starting name for the character. Specify multiple to randomize. + Default Female Name = Nia, Lea, Poppy, Ruby, Arc + + # A default starting name for the character. Specify multiple to randomize. + Default Male Name = Cyrus, Odin, Usio, Lucio + # Amount of spd to increase/decrease vertically as you climb staircases StaircaseClimbSpd = 45 diff --git a/Adventures in Lestoria/olcPixelGameEngine.h b/Adventures in Lestoria/olcPixelGameEngine.h index bc97d09f..8732595b 100644 --- a/Adventures in Lestoria/olcPixelGameEngine.h +++ b/Adventures in Lestoria/olcPixelGameEngine.h @@ -1208,6 +1208,7 @@ namespace olc // Text Entry Routines void TextEntryEnable(const bool bEnable, const std::string& sText = ""); const std::string&TextEntryGetString() const; + void TextEntrySetString(const std::string&str); int32_t TextEntryGetCursor() const; bool IsTextEntryEnabled() const; void TextEntrySetCharLimit(const uint8_t charLimit); @@ -4299,6 +4300,12 @@ namespace olc const std::string&PixelGameEngine::TextEntryGetString() const { return sTextEntryString; } + + void PixelGameEngine::TextEntrySetString(const std::string&str){ + sTextEntryString=str; + nTextEntryCursor=sTextEntryString.length(); + }; + int32_t PixelGameEngine::TextEntryGetCursor() const { return nTextEntryCursor; }