Move Settings Window items into a Scrollable Window Component. Rearranged/Resized items to accomodate for it. Fix a bug with not specifying a menu navigation group meaning that the menu will always default to the default button instead of the actual component navigation groups defined. Release Build 8131.

mac-build
sigonasr2 9 months ago
parent 73819416cc
commit 122e3ecffd
  1. 3
      Adventures in Lestoria/Menu.cpp
  2. 36
      Adventures in Lestoria/SettingsWindow.cpp
  3. 4
      Adventures in Lestoria/Slider.h
  4. 4
      Adventures in Lestoria/TODO.txt
  5. 2
      Adventures in Lestoria/Version.h
  6. BIN
      x64/Release/Adventures in Lestoria.exe

@ -389,6 +389,9 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
std::string selectionButtonName=selection.lock()->GetName();
if(!selection.lock()->parentComponent.expired()){ //If a component has a parent, then we use the parent as the identifier for what should happen next.
selectionButtonName=selection.lock()->parentComponent.lock()->GetName();
if(!navigationGroups.count(selectionButtonName)){ //When there are no navigation groups, we want it to behave as if the other navigation groups defined for each button exists. This is more useful when the scrollable component does not have dynamic items, like the settings window.
selectionButtonName=selection.lock()->GetName(); //Default back to our name as the navigation group handler.
}
}
if(navigationGroups.count(selectionButtonName)){
Navigation nav=navigationGroups[selectionButtonName];

@ -50,6 +50,7 @@ All rights reserved.
#include "InputDisplayComponent.h"
#include "GameSettings.h"
#include "MenuIconButton.h"
#include "ScrollableWindowComponent.h"
INCLUDE_DATA
INCLUDE_game
@ -71,12 +72,15 @@ void Menu::InitializeSettingsWindow(){
return true;
})END;
settingsWindow->ADD("Settings Label",MenuLabel)(geom2d::rect<float>{{4,4},vf2d{windowSize.x-20,24}},"Game Settings",2.f,ComponentAttr::BACKGROUND|ComponentAttr::OUTLINE|ComponentAttr::SHADOW)END;
settingsWindow->ADD("Settings Label",MenuLabel)(geom2d::rect<float>{{4,4},vf2d{windowSize.x-8,24}},"Game Settings",2.f,ComponentAttr::BACKGROUND|ComponentAttr::OUTLINE|ComponentAttr::SHADOW)END;
settingsWindow->F(A::LAST_BGM_VOLUME)=1.f;
settingsWindow->F(A::LAST_SFX_VOLUME)=1.f;
settingsWindow->ADD("BGM Slider",Slider)(geom2d::rect<float>{vf2d{windowSize.x/2-64,32},{172,16}},"BGM Volume:",Audio::GetBGMVolume(),[](float val){
//windowsize.y-20
auto settingsList=settingsWindow->ADD("Settings Scroll List",ScrollableWindowComponent)(geom2d::rect<float>{{4,32},{windowSize.x-8,windowSize.y-56}})END;
settingsList->ADD("BGM Slider",Slider)(geom2d::rect<float>{vf2d{windowSize.x/2-64,0},{172,16}},"BGM Volume:",Audio::GetBGMVolume(),[](float val){
if(Menu::IsCurrentlyActive(SETTINGS)){
if(abs(Menu::menus[SETTINGS]->F(A::LAST_BGM_VOLUME)-val)>=0.04f){
SoundEffect::PlaySFX("Change Volume",SoundEffect::CENTERED);
@ -85,7 +89,7 @@ void Menu::InitializeSettingsWindow(){
Audio::SetBGMVolume(val);
}
})END;
settingsWindow->ADD("SFX Slider",Slider)(geom2d::rect<float>{vf2d{windowSize.x/2-64,52},{172,16}},"SFX Volume:",Audio::GetSFXVolume(),[](float val){
settingsList->ADD("SFX Slider",Slider)(geom2d::rect<float>{vf2d{windowSize.x/2-64,20},{172,16}},"SFX Volume:",Audio::GetSFXVolume(),[](float val){
if(Menu::IsCurrentlyActive(SETTINGS)){
if(abs(Menu::menus[SETTINGS]->F(A::LAST_SFX_VOLUME)-val)>=0.04f){
SoundEffect::PlaySFX("Change Volume",SoundEffect::CENTERED);
@ -93,12 +97,12 @@ void Menu::InitializeSettingsWindow(){
}
}
})END;
settingsWindow->ADD("Screen Shake Checkbox",Checkbox)(geom2d::rect<float>{{4.f,72},{16.f,16.f}},[](ToggleFuncData data){
settingsList->ADD("Screen Shake Checkbox",Checkbox)(geom2d::rect<float>{{4.f,40},{16.f,16.f}},[](ToggleFuncData data){
GameSettings::SetScreenShake(data.checked);
return true;
},true)END;
settingsWindow->ADD("Screen Shake Label",MenuLabel)(geom2d::rect<float>{{22.f,72},{windowSize.x/2-24.f,16.f}},"Screen Shake",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
settingsWindow->ADD("Controller Rumble Checkbox",Checkbox)(geom2d::rect<float>{{4.f,92},{16.f,16.f}},[](ToggleFuncData data){
settingsList->ADD("Screen Shake Label",MenuLabel)(geom2d::rect<float>{{22.f,40},{windowSize.x/2-24.f,16.f}},"Screen Shake",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
settingsList->ADD("Controller Rumble Checkbox",Checkbox)(geom2d::rect<float>{{4.f,60},{16.f,16.f}},[](ToggleFuncData data){
if(Menu::IsCurrentlyActive(SETTINGS)){
GameSettings::SetRumble(data.checked);
if(GameSettings::RumbleEnabled(GameSettings::OVERRIDE)){
@ -110,20 +114,20 @@ void Menu::InitializeSettingsWindow(){
}
return true;
},true)END;
settingsWindow->ADD("Controller Rumble Label",MenuLabel)(geom2d::rect<float>{{22.f,92},{windowSize.x/2-24.f,16.f}},"Gamepad Rumble",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
settingsList->ADD("Controller Rumble Label",MenuLabel)(geom2d::rect<float>{{22.f,60},{windowSize.x/2-24.f,16.f}},"Gamepad Rumble",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
settingsWindow->ADD("Terrain Collision Boxes Checkbox",Checkbox)(geom2d::rect<float>{{windowSize.x/2+4.f,72},{16.f,16.f}},[](ToggleFuncData data){
settingsList->ADD("Terrain Collision Boxes Checkbox",Checkbox)(geom2d::rect<float>{{windowSize.x/2+4.f,40},{16.f,16.f}},[](ToggleFuncData data){
GameSettings::SetTerrainCollisionBoxes(data.checked);
return true;
},true)END;
settingsWindow->ADD("Terrain Collision Boxes Label",MenuLabel)(geom2d::rect<float>{{windowSize.x/2+22.f,72},{windowSize.x/2-24.f,16.f}},"Terrain Collision Boxes",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
settingsWindow->ADD("Keyboard Play Auto-Aim Checkbox",Checkbox)(geom2d::rect<float>{{windowSize.x/2+4.f,92},{16.f,16.f}},[](ToggleFuncData data){
settingsList->ADD("Terrain Collision Boxes Label",MenuLabel)(geom2d::rect<float>{{windowSize.x/2+22.f,40},{windowSize.x/2-24.f,16.f}},"Terrain Collision Boxes",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
settingsList->ADD("Keyboard Play Auto-Aim Checkbox",Checkbox)(geom2d::rect<float>{{windowSize.x/2+4.f,60},{16.f,16.f}},[](ToggleFuncData data){
GameSettings::SetKeyboardAutoAim(data.checked);
return true;
},false)END;
settingsWindow->ADD("Keyboard Play Auto-Aim Label",MenuLabel)(geom2d::rect<float>{{windowSize.x/2+22.f,92},{windowSize.x/2-24.f,16.f}},"Aim Assist\n(No Mouse Players)",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
settingsList->ADD("Keyboard Play Auto-Aim Label",MenuLabel)(geom2d::rect<float>{{windowSize.x/2+22.f,60},{windowSize.x/2-24.f,16.f}},"Aim Assist\n(No Mouse Players)",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
auto fullscreenToggle=settingsWindow->ADD("Fullscreen Toggle Checkbox",Checkbox)(geom2d::rect<float>{{windowSize.x/2+4.f,112},{16.f,16.f}},[](ToggleFuncData data){
auto fullscreenToggle=settingsList->ADD("Fullscreen Toggle Checkbox",Checkbox)(geom2d::rect<float>{{windowSize.x/2+4.f,80},{16.f,16.f}},[](ToggleFuncData data){
if(data.checked){ //When going to fullscreen mode, the windowed mode positioning needs to be saved to be restored later.
GameSettings::SetWindowPos(game->GetActualWindowPos());
}
@ -133,13 +137,13 @@ void Menu::InitializeSettingsWindow(){
game->SetFullscreen(data.checked,GameSettings::GetWindowPos());
return true;
},game->IsFullscreen())END;
auto fullscreenToggleLabel=settingsWindow->ADD("Fullscreen Toggle Label",MenuLabel)(geom2d::rect<float>{{windowSize.x/2+22.f,112},{windowSize.x/2-24.f,16.f}},"Fullscreen",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
auto fullscreenToggleLabel=settingsList->ADD("Fullscreen Toggle Label",MenuLabel)(geom2d::rect<float>{{windowSize.x/2+22.f,80},{windowSize.x/2-24.f,16.f}},"Fullscreen",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
#ifdef __EMSCRIPTEN__
fullscreenToggle->Disable();
fullscreenToggleLabel->Disable();
#endif
settingsWindow->ADD("Button Set Toggle Box",MenuIconButton)(geom2d::rect<float>{{windowSize.x/8.f,112},{windowSize.x/4.f,16.f}},GFX["themes/xb.png"].Decal(),[](MenuFuncData data){
settingsList->ADD("Button Set Toggle Box",MenuIconButton)(geom2d::rect<float>{{windowSize.x/8.f,80},{windowSize.x/4.f,16.f}},GFX["themes/xb.png"].Decal(),[](MenuFuncData data){
switch(GameSettings::GetIconType()){
case IconType::XB:{
GameSettings::SetIconType(IconType::PS);
@ -185,13 +189,13 @@ void Menu::InitializeSettingsWindow(){
};
#pragma endregion
settingsWindow->ADD("Keyboard Bindings Button",MenuComponent)(geom2d::rect<float>{{28,132.f},vf2d{windowSize.x-32,24}},"Keyboard Bindings",[&](MenuFuncData data){
settingsList->ADD("Keyboard Bindings Button",MenuComponent)(geom2d::rect<float>{{28,100.f},vf2d{settingsList->rect.size.x-12-56,24}},"Keyboard Bindings",[&](MenuFuncData data){
ChangeKeybindDisplayType(KEY);
Component<MenuLabel>(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<float>{{28,160.f},vf2d{windowSize.x-32,24}},"Controller Bindings",[&](MenuFuncData data){
settingsList->ADD("Controller Bindings Button",MenuComponent)(geom2d::rect<float>{{28,128.f},vf2d{settingsList->rect.size.x-12-56,24}},"Controller Bindings",[&](MenuFuncData data){
ChangeKeybindDisplayType(CONTROLLER);
Component<MenuLabel>(INPUT_KEY_DISPLAY,"Keyboard Mapping Label")->SetLabel("Controller Mappings");
Menu::OpenMenu(INPUT_KEY_DISPLAY);

@ -83,7 +83,7 @@ public:
dragging=true;
}
if(dragging||(hovered&&!Menu::UsingMouseNavigation())){
if(dragging&&Menu::UsingMouseNavigation()||hovered&&!Menu::UsingMouseNavigation()){
if(Menu::UsingMouseNavigation()){
val=GetSliderVal(game->GetMouseX()-Menu::menus[parentMenu]->pos.x-8);
}else{
@ -121,7 +121,7 @@ public:
window.FillRectDecal(vf2d{rect.pos.x+4,rect.pos.y+rect.size.y/2-1}+vf2d{0.f,1.f},{rect.size.x-8,2},BLACK);
window.FillRectDecal(vf2d{rect.pos.x+4,rect.pos.y+rect.size.y/2-1},{rect.size.x-8,2});
window.DrawRotatedDecal(vf2d{GetSliderX(),rect.pos.y+rect.size.y/2},GFX["circle.png"].Decal(),0.f,vf2d(GFX["circle.png"].Sprite()->Size())/2.f,{5.f,5.f},BLACK);
window.DrawRotatedDecal(vf2d{GetSliderX(),rect.pos.y+rect.size.y/2},GFX["circle.png"].Decal(),0.f,vf2d(GFX["circle.png"].Sprite()->Size())/2.f,{5.f,5.f},WHITE);
window.DrawRotatedDecal(vf2d{GetSliderX(),rect.pos.y+rect.size.y/2},GFX["circle.png"].Decal(),0.f,vf2d(GFX["circle.png"].Sprite()->Size())/2.f,{4.f,4.f},backCol);
vf2d valDisplayTextSize=game->GetTextSize(std::to_string(minMaxDisplayValues.second));

@ -10,4 +10,6 @@ should gemstones dropp from boss stages aswell? (Maybe lower droprate?)
Toggle for displaying error messages
Low health warning
Low health warning
I think thats your easiest bet, option to display as is, full numbers (which may/will get super small), and scientific notation as a middle ground if the full one does get crazy. That should please most people looking for information on those stats

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 5
#define VERSION_PATCH 1
#define VERSION_BUILD 8115
#define VERSION_BUILD 8131
#define stringify(a) stringify_(a)
#define stringify_(a) #a

Loading…
Cancel
Save