diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj
index 7e2958e0..ba036241 100644
--- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj
+++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj
@@ -342,6 +342,10 @@
+
+
+
+
@@ -574,6 +578,10 @@
+
+
+
+
@@ -791,6 +799,7 @@
+
diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
index 2084fa2d..066552d8 100644
--- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
+++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
@@ -474,6 +474,9 @@
Header Files
+
+ Header Files\Interface
+
@@ -836,6 +839,9 @@
Source Files
+
+ Source Files\Interface
+
@@ -990,6 +996,9 @@
Configurations\Setttings
+
+ Configurations
+
diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp
index 1466d7cb..26b3ed9d 100644
--- a/Adventures in Lestoria/AdventuresInLestoria.cpp
+++ b/Adventures in Lestoria/AdventuresInLestoria.cpp
@@ -221,6 +221,9 @@ AiL::AiL()
std::string ENVIRONMENTAL_AUDIO_CONFIG = CONFIG_PATH + "environmental_audio_config"_S;
utils::datafile::Read(DATA,ENVIRONMENTAL_AUDIO_CONFIG);
+ std::string CREDITS_CONFIG = CONFIG_PATH + "credits_config"_S;
+ utils::datafile::Read(DATA,CREDITS_CONFIG);
+
utils::datafile::DEBUG_ACCESS_OPTIONS="debug_access_options"_I;
sAppName = "GAME_NAME"_S;
diff --git a/Adventures in Lestoria/CreditsWindow.cpp b/Adventures in Lestoria/CreditsWindow.cpp
new file mode 100644
index 00000000..f8ade7dc
--- /dev/null
+++ b/Adventures in Lestoria/CreditsWindow.cpp
@@ -0,0 +1,89 @@
+#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
+#include "AdventuresInLestoria.h"
+#include "Menu.h"
+#include "ScrollableWindowComponent.h"
+#include "MenuLabel.h"
+
+INCLUDE_WINDOW_SIZE
+
+void Menu::InitializeCreditsWindow(){
+ vf2d windowSize=WINDOW_SIZE-vf2d{78,78};
+
+ Menu*creditsWindow=CreateMenu(MenuType::CREDITS,CENTERED,windowSize);
+
+ auto displayScrollWindow=creditsWindow->ADD("Display Text Scroll Window",ScrollableWindowComponent)(geom2d::rect{{4,4},windowSize-vf2d{8,8}})END;
+
+ displayScrollWindow->ADD("Display Text",MenuLabel)(geom2d::rect{{2,2},windowSize-vf2d{24,12}},"Test Text\nEven more testing text that we could use for this game.",1.f,ComponentAttr::CENTER)END;
+
+ creditsWindow->ADD("Go Back Button",MenuComponent)(geom2d::rect{{windowSize.x/2.f-48.f,windowSize.y},{96.f,12.f}},"Back",[](MenuFuncData data){
+ Menu::CloseMenu();
+ return true;
+ })END;
+
+ creditsWindow->SetupKeyboardNavigation(
+ [](MenuType type,Data&returnData){ //On Open
+ returnData="Go Back Button";
+ },
+ { //Button Key
+ {{game->KEY_SCROLLUP,Held},{"",[](MenuType type){
+ Component(type,"Display Text Scroll Window")->Scroll(1.f);
+ }}},
+ {{game->KEY_SCROLLDOWN,Held},{"",[](MenuType type){
+ Component(type,"Display Text Scroll Window")->Scroll(-1.f);
+ }}},
+ {{game->KEY_SHOULDER,Pressed},{"Scroll Encounters",[](MenuType type){
+ Component(type,"Display Text Scroll Window")->Scroll(-1.0f);
+ }}},
+ {{game->KEY_FASTSCROLLUP,Held,InputEngageGroup::NOT_VISIBLE},{"Scroll",[](MenuType type){
+ Component(type,"Display Text Scroll Window")->Scroll(-1.0f);
+ }}},
+ {{game->KEY_FASTSCROLLDOWN,Held,InputEngageGroup::NOT_VISIBLE},{"Scroll",[](MenuType type){
+ Component(type,"Display Text Scroll Window")->Scroll(1.0f);
+ }}},
+ {{game->KEY_SCROLLVERT_R,Analog,InputEngageGroup::NOT_VISIBLE},{"Scroll",[](MenuType type){
+ Component(type,"Display Text Scroll Window")->Scroll(game->KEY_SCROLLVERT.Analog());
+ }}},
+ {game->KEY_BACK,{"Back",[](MenuType type){
+ Component(type,"Go Back Button")->Click();
+ }}},
+ {game->KEY_CONFIRM,{"Back",[](MenuType type){}}},
+ }
+ ,{ //Button Navigation Rules
+ });
+}
\ No newline at end of file
diff --git a/Adventures in Lestoria/DeathMenu.cpp b/Adventures in Lestoria/DeathMenu.cpp
index eb3b22bb..ca3da953 100644
--- a/Adventures in Lestoria/DeathMenu.cpp
+++ b/Adventures in Lestoria/DeathMenu.cpp
@@ -69,11 +69,6 @@ void Menu::InitializeDeathWindow(){
},
{ //Button Key
{game->KEY_SCROLL,{"Navigate",[](MenuType type){}}},
- {game->KEY_MENU,{"Resume",[](MenuType type){
- if(!Menu::menus[type]->GetSelection().expired()){
- Menu::menus[type]->GetSelection().lock()->Click();
- }
- }}},
{game->KEY_CONFIRM,{"Select",[](MenuType type){}}},
}
,{ //Button Navigation Rules
diff --git a/Adventures in Lestoria/FloatingMenuComponent.h b/Adventures in Lestoria/FloatingMenuComponent.h
new file mode 100644
index 00000000..2b869a9c
--- /dev/null
+++ b/Adventures in Lestoria/FloatingMenuComponent.h
@@ -0,0 +1,107 @@
+#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"
+#include "AdventuresInLestoria.h"
+#include "drawutil.h"
+#include "util.h"
+#include "ScrollableWindowComponent.h"
+
+using A=Attribute;
+
+INCLUDE_game
+
+//A button that directly draws in a location in the game.
+class FloatingMenuComponent:public MenuComponent{
+public:
+ inline FloatingMenuComponent(geom2d::rectrect,std::string label,MenuFunc onClick,ButtonAttr attributes=ButtonAttr::NONE)
+ :MenuComponent(rect,label,onClick,attributes){};
+
+ inline virtual bool HandleOutsideDisabledButtonSelection(std::weak_ptrdisabledButton)override final{
+ return true;
+ };
+
+ inline virtual bool GetHoverState(AiL*game){
+ if(!parentComponent.expired()){
+ return parentComponent.lock()->GetHoverState(game,this);
+ }else{
+ return geom2d::overlaps(geom2d::rect{rect.pos,rect.size},game->GetMousePos());
+ }
+ }
+
+ inline virtual void DrawDecal(ViewPort&window,bool focused)override final{
+ if(background){
+ Pixel backCol=PixelLerp(Menu::themes[Menu::themeSelection].GetButtonCol(),Menu::themes[Menu::themeSelection].GetHighlightCol(),hoverEffect/"ThemeGlobal.HighlightTime"_F);
+ if(grayedOut){
+ backCol=DARK_GREY;
+ }
+ game->FillRectDecal(rect.pos+V(A::DRAW_OFFSET),rect.size,backCol);
+ }
+ if(selected&&selectionType==HIGHLIGHT){
+ game->FillRectDecal(rect.pos+V(A::DRAW_OFFSET),rect.size,PixelLerp(Menu::themes[Menu::themeSelection].GetButtonCol(),Menu::themes[Menu::themeSelection].GetHighlightCol(),util::lerp(0.75f,1.0f,hoverEffect/"ThemeGlobal.HighlightTime"_F)));
+ }
+ if(border){
+ game->FillRectDecal(rect.pos+V(A::DRAW_OFFSET),{rect.size.x+1,1},borderCol);
+ game->FillRectDecal(rect.pos+V(A::DRAW_OFFSET),{1,rect.size.y+1},borderCol);
+ game->FillRectDecal(rect.pos+V(A::DRAW_OFFSET)+vf2d{rect.size.x-1+1,0},{1,rect.size.y+1},borderCol);
+ game->FillRectDecal(rect.pos+V(A::DRAW_OFFSET)+vf2d{0,rect.size.y-1+1},{rect.size.x+1,1},borderCol);
+ }
+ if(showDefaultLabel){
+ vf2d adjustedScale=labelScaling;
+ vi2d labelTextSize=vf2d(game->GetTextSizeProp(label))*adjustedScale;
+
+ if(fitToLabel){
+ float sizeRatio=(vf2d(labelTextSize).x)/(rect.size.x-2);
+ if(sizeRatio>1){
+ adjustedScale.x/=sizeRatio;
+ labelTextSize.x/=sizeRatio;
+ }
+ }
+ game->DrawStringPropDecal(rect.pos+V(A::DRAW_OFFSET)+rect.size/2-vf2d(labelTextSize)/2.f,label,WHITE,adjustedScale);
+ }
+ if(selected){
+ switch(selectionType){
+ case CROSSHAIR:drawutil::DrawCrosshairDecal(game,{rect.pos+V(A::DRAW_OFFSET),rect.size},0);break;
+ case INNER_BOX:game->DrawRectDecal(rect.pos+V(A::DRAW_OFFSET)+vi2d{1,1},rect.size-vi2d{2,2});break;
+ case HIGHLIGHT:break;//Not used.
+ case SelectionType::NONE:break;//Displays nothing.
+ default:ERR("Undefined selection type selected: "<EndGame();
return true;
})END;
+ mainMenuWindow->ADD("Credits Button",FloatingMenuComponent)(geom2d::rect{{game->ScreenWidth()-74.f,game->ScreenHeight()-38.f},{72.f,20.f}},"Credits",[](MenuFuncData data){
+ Menu::OpenMenu(CREDITS);
+ return true;
+ })END;
mainMenuWindow->SetupKeyboardNavigation(
[](MenuType type,Data&returnData){ //On Open
@@ -79,19 +83,45 @@ void Menu::InitializeMainMenuWindow(){
},
{ //Button Key
{game->KEY_CONFIRM,{"Select",[](MenuType type){}}},
+ {game->KEY_SELECT,{"Credits",[](MenuType type){}}},
}
,{ //Button Navigation Rules
{"New Game Button",{
.up="Quit Game Button",
- .down="Load Game Button",}},
+ .down="Load Game Button",
+ .left="Credits Button",
+ .right="Credits Button",}},
{"Load Game Button",{
.up="New Game Button",
- .down="Settings Button",}},
+ .down="Settings Button",
+ .left="Credits Button",
+ .right="Credits Button",}},
{"Settings Button",{
.up="Load Game Button",
- .down="Quit Game Button",}},
+ .down="Quit Game Button",
+ .left="Credits Button",
+ .right="Credits Button",}},
{"Quit Game Button",{
.up="Settings Button",
- .down="New Game Button",}},
+ .down="New Game Button",
+ .left="Credits Button",
+ .right="Credits Button",}},
+ {"Credits Button",{
+ .up="Load Game Button",
+ .down="Quit Game Button",
+ .left=[](MenuType type,Data&returnData){
+ if(SaveFile::GetSaveFileCount()>0){
+ returnData="Load Game Button";
+ }else{
+ returnData="New Game Button";
+ }
+ },
+ .right=[](MenuType type,Data&returnData){
+ if(SaveFile::GetSaveFileCount()>0){
+ returnData="Load Game Button";
+ }else{
+ returnData="New Game Button";
+ }
+ },}},
});
}
\ No newline at end of file
diff --git a/Adventures in Lestoria/Menu.cpp b/Adventures in Lestoria/Menu.cpp
index 301c1625..2d173ced 100644
--- a/Adventures in Lestoria/Menu.cpp
+++ b/Adventures in Lestoria/Menu.cpp
@@ -107,6 +107,7 @@ void Menu::InitializeMenus(){
InitializeNewKeybindInputWindow();
InitializePauseWindow();
InitializeDeathWindow();
+ InitializeCreditsWindow();
for(MenuType type=MenuType(int(MenuType::ENUM_START)+1);typeMAX_MENUS)ERR("WARNING! Exceeded maximum expected menu count of "<(CREDITS,"Display Text")->SetLabel(credits);
}
Menu*Menu::CreateMenu(MenuType type,vf2d pos,vf2d size){
diff --git a/Adventures in Lestoria/Menu.h b/Adventures in Lestoria/Menu.h
index 60cb0ef8..3d47ab5d 100644
--- a/Adventures in Lestoria/Menu.h
+++ b/Adventures in Lestoria/Menu.h
@@ -111,6 +111,7 @@ class Menu:public IAttributable{
static void InitializeNewKeybindInputWindow();
static void InitializePauseWindow();
static void InitializeDeathWindow();
+ static void InitializeCreditsWindow();
friend class AiL;
friend class ItemInfo;
diff --git a/Adventures in Lestoria/MenuComponent.h b/Adventures in Lestoria/MenuComponent.h
index 6d087daa..d4061b6a 100644
--- a/Adventures in Lestoria/MenuComponent.h
+++ b/Adventures in Lestoria/MenuComponent.h
@@ -55,6 +55,7 @@ enum class ComponentAttr{
BACKGROUND= 0b0'0001'0000, //Renders the background of the menu theme for this component.
FIT_TO_LABEL= 0b0'0010'0000, //Scales the text horizontally to fit the label if the text takes up more space rather than wrapping.
FIXED_WIDTH_FONT= 0b0'0100'0000, //Uses a fixed-width font (instead of a proportional one) for text rendering.
+ CENTER= 0b0'1000'0000, //Multi-line Centering for MenuLabels.
};
enum class SelectionType{
@@ -79,6 +80,7 @@ class MenuComponent:public IAttributable{
friend class MenuItemItemButton;
friend class RowItemDisplay;
friend class InventoryConsumableWindow;
+ friend class FloatingMenuComponent;
MenuFunc onHover=[](MenuFuncData dat){return true;};
MenuFunc onMouseOut=[](MenuFuncData dat){return true;};
bool hoverState=false;
diff --git a/Adventures in Lestoria/MenuItemButton.h b/Adventures in Lestoria/MenuItemButton.h
index dbefc439..13217f51 100644
--- a/Adventures in Lestoria/MenuItemButton.h
+++ b/Adventures in Lestoria/MenuItemButton.h
@@ -37,8 +37,8 @@ All rights reserved.
#pragma endregion
#pragma once
#include "Menu.h"
-#include "MenuLabel.h"
#include "MenuIconButton.h"
+#include "MenuLabel.h"
#include "DEFINES.h"
#include "AdventuresInLestoria.h"
#include "Item.h"
diff --git a/Adventures in Lestoria/MenuLabel.h b/Adventures in Lestoria/MenuLabel.h
index 0de76a55..ecc4f47c 100644
--- a/Adventures in Lestoria/MenuLabel.h
+++ b/Adventures in Lestoria/MenuLabel.h
@@ -41,6 +41,7 @@ All rights reserved.
#include "DEFINES.h"
#include "olcPGEX_ViewPort.h"
#include "util.h"
+#include "ScrollableWindowComponent.h"
INCLUDE_game
@@ -49,10 +50,16 @@ protected:
float scale=1;
bool shadow=false;
bool centered=true;
+ bool multiLineCentered=false;
bool rightAlign=false;
bool proportional=true;
bool runOnLabelChangeFunc=false;
std::functiononLabelChangeFunc;
+
+ //Specific wrapping members.
+ std::string wrappedLabel;
+ std::vectorlines;
+ std::vectoroffsets;
public:
inline MenuLabel(geom2d::rectrect,std::string label,std::functiononLabelChangeFunc,float scale=1,ComponentAttr attributes=ComponentAttr::NONE)
:MenuLabel(rect,label,scale,attributes){
@@ -60,14 +67,16 @@ public:
this->onLabelChangeFunc=onLabelChangeFunc;
}
inline MenuLabel(geom2d::rectrect,std::string label,float scale=1,ComponentAttr attributes=ComponentAttr::NONE)
- :MenuComponent(rect,label,MenuFunc{},ButtonAttr::UNSELECTABLE|ButtonAttr::UNSELECTABLE_VIA_KEYBOARD),scale(scale),rightAlign(attributes&ComponentAttr::RIGHT_ALIGN),centered(!(attributes&ComponentAttr::LEFT_ALIGN)&&!(attributes&ComponentAttr::RIGHT_ALIGN)),shadow(attributes&ComponentAttr::SHADOW),proportional(!(attributes&ComponentAttr::FIXED_WIDTH_FONT)){
+ :MenuComponent(rect,label,MenuFunc{},ButtonAttr::UNSELECTABLE|ButtonAttr::UNSELECTABLE_VIA_KEYBOARD),scale(scale),rightAlign(attributes&ComponentAttr::RIGHT_ALIGN),centered(!(attributes&ComponentAttr::LEFT_ALIGN)&&!(attributes&ComponentAttr::RIGHT_ALIGN)),shadow(attributes&ComponentAttr::SHADOW),proportional(!(attributes&ComponentAttr::FIXED_WIDTH_FONT)),multiLineCentered(attributes&ComponentAttr::CENTER){
border=attributes&ComponentAttr::OUTLINE;
this->background=attributes&ComponentAttr::BACKGROUND;
showDefaultLabel=false;
fitToLabel=attributes&ComponentAttr::FIT_TO_LABEL;
+ CalculateWrappedLabel();
}
inline virtual void SetLabel(std::string text)override{
MenuComponent::SetLabel(text);
+ CalculateWrappedLabel();
if(runOnLabelChangeFunc)onLabelChangeFunc(text);
}
protected:
@@ -102,19 +111,72 @@ protected:
drawPos=vf2d{rect.pos.x+2,rect.middle().y-labelTextSize.y/2}; //We should at least vertically align here.
}
}
-
- if(shadow){
- if(proportional){
- window.DrawShadowStringPropDecal(drawPos,GetLabel(),WHITE,BLACK,adjustedScale,fitToLabel?std::numeric_limits::max():rect.size.x-2,1.0f);
+ if(multiLineCentered){
+ if(shadow){
+ if(proportional){
+ for(int counter=0;const std::string_view&text:lines){
+ window.DrawShadowStringPropDecal(rect.pos+vf2d{offsets[counter],counter*10.f},text,WHITE,BLACK);
+ counter++;
+ }
+ }else{
+ ERR("WARNING! Unsupported Feature!");
+ }
}else{
- window.DrawShadowStringDecal(drawPos,GetLabel(),WHITE,BLACK,adjustedScale,fitToLabel?std::numeric_limits::max():rect.size.x-2,1.0f);
+ if(proportional){
+ for(int counter=0;const std::string_view&text:lines){
+ window.DrawStringPropDecal(rect.pos+vf2d{offsets[counter],counter*10.f},text,WHITE);
+ counter++;
+ }
+ }else{
+ ERR("WARNING! Unsupported Feature!");
+ }
}
}else{
- if(proportional){
- window.DrawStringPropDecal(drawPos,GetLabel(),WHITE,adjustedScale,fitToLabel?std::numeric_limits::max():rect.size.x-2,1.0f);
+ if(shadow){
+ if(proportional){
+ window.DrawShadowStringPropDecal(drawPos,GetLabel(),WHITE,BLACK,adjustedScale,fitToLabel?std::numeric_limits::max():rect.size.x-2,1.0f);
+ }else{
+ window.DrawShadowStringDecal(drawPos,GetLabel(),WHITE,BLACK,adjustedScale,fitToLabel?std::numeric_limits::max():rect.size.x-2,1.0f);
+ }
}else{
- window.DrawStringDecal(drawPos,GetLabel(),WHITE,adjustedScale,fitToLabel?std::numeric_limits::max():rect.size.x-2,1.0f);
+ if(proportional){
+ window.DrawStringPropDecal(drawPos,GetLabel(),WHITE,adjustedScale,fitToLabel?std::numeric_limits::max():rect.size.x-2,1.0f);
+ }else{
+ window.DrawStringDecal(drawPos,GetLabel(),WHITE,adjustedScale,fitToLabel?std::numeric_limits::max():rect.size.x-2,1.0f);
+ }
}
}
}
+private:
+ inline void CalculateWrappedLabel(){
+ lines.clear();
+ offsets.clear();
+ if(multiLineCentered){
+ wrappedLabel=util::WrapText(game,GetLabel(),rect.size.x,true,{1.f,1.f});
+ int labelInd=0;
+ float largestWidth=0;
+ while(labelInd!=wrappedLabel.length()){
+ auto nextLine=std::find(wrappedLabel.begin()+labelInd,wrappedLabel.end(),'\n');
+ std::string_view text;
+ if(nextLine!=wrappedLabel.end()){
+ text=std::string_view(GetLabel()).substr(labelInd,std::distance(wrappedLabel.begin()+labelInd,nextLine));
+ lines.push_back(text);
+ labelInd+=std::distance(wrappedLabel.begin(),nextLine)-labelInd+1;
+ }else{
+ text=std::string_view(wrappedLabel).substr(labelInd);
+ lines.push_back(text);
+ labelInd=wrappedLabel.length();
+ }
+ }
+ for(const std::string_view&text:lines){
+ float width=game->GetTextSizeProp(text).x;
+ offsets.push_back(rect.size.x/2.f-width/2);
+ }
+ }
+ //Recalculate label height based on line count.
+ rect.size.y=lines.size()*10.f;
+ if(!parentComponent.expired()){
+ parentComponent.lock()->CalculateBounds();
+ }
+ }
};
\ No newline at end of file
diff --git a/Adventures in Lestoria/MenuType.h b/Adventures in Lestoria/MenuType.h
index 456b6833..5fd72cfe 100644
--- a/Adventures in Lestoria/MenuType.h
+++ b/Adventures in Lestoria/MenuType.h
@@ -41,7 +41,7 @@ enum MenuType{
///////////////////////////////////////////////////////////
/*DO NOT REMOVE!!*/ENUM_START,///////////////////////////////
///////////////////////////////////////////////////////////
- // 100% Controller Compatibility. (104 total items, 4 items per menu * 26 menus)
+ // 100% Controller Compatibility. (108 total items, 4 items per menu * 27 menus)
INVENTORY_CONSUMABLES, //100% Controller Compatibility
CLASS_INFO, //100% Controller Compatibility
CLASS_SELECTION, //100% Controller Compatibility
@@ -68,6 +68,7 @@ enum MenuType{
NEW_INPUT, //100% Controller Compatibility
PAUSE, //100% Controller Compatibility
DEATH, //100% Controller Compatibility
+ CREDITS, //100% Controller Compatibility
///////////////////////////////////////////////////////////
/*DO NOT REMOVE!!*/ENUM_END////////////////////////////////
///////////////////////////////////////////////////////////
diff --git a/Adventures in Lestoria/ScrollableWindowComponent.h b/Adventures in Lestoria/ScrollableWindowComponent.h
index 01734a60..6a863543 100644
--- a/Adventures in Lestoria/ScrollableWindowComponent.h
+++ b/Adventures in Lestoria/ScrollableWindowComponent.h
@@ -38,11 +38,12 @@ All rights reserved.
#pragma once
#include "Menu.h"
#include "MenuComponent.h"
-#include "MenuItemButton.h"
#include "AdventuresInLestoria.h"
using A=Attribute;
+INCLUDE_game
+
class ScrollableWindowComponent:public MenuComponent{
friend class Menu;
protected:
@@ -273,6 +274,7 @@ protected:
DrawScrollbar(window,{},focused);
}
}
+public:
//Calculates the bounds of all components.
inline void CalculateBounds(){
bounds={};
diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt
index fa3a1210..88765c46 100644
--- a/Adventures in Lestoria/TODO.txt
+++ b/Adventures in Lestoria/TODO.txt
@@ -2,10 +2,4 @@ February 28th -> Begin Internal Game Playtesting
March 6th -> Discord/Friend Playtesting
March 30th -> Public Demo Release
-- Hide mouse cursor during controller play. Reveal it again during mouse play.
-
-- Condense stage track (loading times)
-
-- Credits/Licensing
-
- Check online username boxes (does not show the *?)\
\ No newline at end of file
diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h
index 1aa3a3b4..df92205b 100644
--- a/Adventures in Lestoria/Version.h
+++ b/Adventures in Lestoria/Version.h
@@ -37,9 +37,9 @@ All rights reserved.
#pragma endregion
#pragma once
#define VERSION_MAJOR 0
-#define VERSION_MINOR 3
+#define VERSION_MINOR 4
#define VERSION_PATCH 0
-#define VERSION_BUILD 7795
+#define VERSION_BUILD 7841
#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 58c77fa8..fed894ee 100644
--- a/Adventures in Lestoria/assets/config/configuration.txt
+++ b/Adventures in Lestoria/assets/config/configuration.txt
@@ -91,6 +91,9 @@ interface_config = Interface.txt
# Path to Keyboard Input configuration
input_config = settings/input.txt
+# Path to Credits configuration file
+credits_config = credits.txt
+
# Path to character images
character_image_location = characters/commercial_assets/
diff --git a/Adventures in Lestoria/assets/config/credits.txt b/Adventures in Lestoria/assets/config/credits.txt
new file mode 100644
index 00000000..3529ad4b
--- /dev/null
+++ b/Adventures in Lestoria/assets/config/credits.txt
@@ -0,0 +1,62 @@
+Credits
+{
+ LINE[0]="Development Team"
+ LINE[1]="~~~~~~~~~~~~~~~~"
+ LINE[2]=" "
+ LINE[3]="Production & Programming"
+ LINE[4]="#C03EE5sigonasr2#FFFFFF"
+ LINE[5]=" "
+ LINE[6]="Game Designer"
+ LINE[7]="#7DDA58Quapsel#FFFFFF"
+ LINE[8]=" "
+ LINE[9]="Music Design"
+ LINE[10]="#5DE2E7A2Z#FFFFFF"
+ LINE[11]=" "
+ LINE[12]="Tools & Tech"
+ LINE[13]="~~~~~~~~~~~~~~~~"
+ LINE[14]="Game Engine"
+ LINE[15]="#FE9900javidx9#FFFFFF"
+ LINE[16]="#FEF500olc::PixelGameEngine v.2.24#FFFFFF"
+ LINE[17]=" "
+ LINE[18]="olcPGEX_MiniAudio Copyright© 2024 by Moros Smith under the OLC-3 License"
+ LINE[19]=" "
+ LINE[20]="miniaudio library Copyright© 2024 by David Reid under the MIT No Attribution License"
+ LINE[21]="Ogg Vorbis audio decoder - v1.22 - public domain http://nothings.org/stb_vorbis/"
+ LINE[22]=" "
+ LINE[23]="Portions of this software are copyright © 2024 The FreeType Project (www.freetype.org). All rights reserved."
+ LINE[24]=" "
+ LINE[25]="Assets"
+ LINE[26]="~~~~~~~~~~~~~~~~"
+ LINE[27]="ERA OF FANTASY - GRASSLANDS"
+ LINE[28]="X: @Namatnieks"
+ LINE[29]=" "
+ LINE[30]="*** Minifantasy - Tiny Overworld v1.0 ***"
+ LINE[31]="Minifantasy is an original idea by Krishna Palacio"
+ LINE[32]=" "
+ LINE[33]="Public Domain Font Authors"
+ LINE[34]="c64esque by andraaspar"
+ LINE[35]="Habbo by Omni"
+ LINE[36]="Unknown by Anonymous"
+ LINE[37]=" "
+ LINE[38]="Nb Pixel Font Bundle"
+ LINE[39]="Nb Pixel Font Bundle 2"
+ LINE[40]=" "
+ LINE[41]=" "
+ LINE[42]="Game License"
+ LINE[43]="~~~~~~~~~~~~~~~~"
+ LINE[44]="License (OLC-3)"
+ LINE[45]="~~~~~~~~~~~~~~~"
+ LINE[46]=" "
+ LINE[47]="Copyright 2024 Joshua Sigona "
+ LINE[48]=" "
+ LINE[49]="Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:"
+ LINE[50]=" "
+ LINE[51]="1. Redistributions or derivations of source code must retain the above copyright notice, this list of conditions and the following disclaimer."
+ LINE[52]=" "
+ LINE[53]="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."
+ LINE[54]=" "
+ LINE[55]="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."
+ LINE[56]=" "
+ LINE[57]="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."
+
+}
\ No newline at end of file
diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe
index b21e7b25..a23683a5 100644
Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ