Added additional toggle and setting options in Settings menu. Made screen shake, gamepad rumble, keyboard aim assist, and terrain collision box display toggles functional. Added toggle sound effect. Release Build 7344.

pull/35/head
sigonasr2 12 months ago
parent a39a841166
commit d5bd8655a9
  1. 8
      Adventures in Lestoria/Adventures in Lestoria.vcxproj
  2. 6
      Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
  3. 16
      Adventures in Lestoria/AdventuresInLestoria.cpp
  4. 4
      Adventures in Lestoria/AdventuresInLestoria.h
  5. 8
      Adventures in Lestoria/Checkbox.h
  6. 70
      Adventures in Lestoria/GameSettings.cpp
  7. 54
      Adventures in Lestoria/GameSettings.h
  8. 2
      Adventures in Lestoria/Key.cpp
  9. 64
      Adventures in Lestoria/Menu.cpp
  10. 1
      Adventures in Lestoria/MonsterAttribute.h
  11. 6
      Adventures in Lestoria/Player.cpp
  12. 1
      Adventures in Lestoria/Player.h
  13. 13
      Adventures in Lestoria/SaveFile.cpp
  14. 42
      Adventures in Lestoria/SettingsWindow.cpp
  15. 5
      Adventures in Lestoria/TODO.txt
  16. 2
      Adventures in Lestoria/Version.h
  17. 10
      Adventures in Lestoria/assets/config/audio/events.txt
  18. BIN
      Adventures in Lestoria/assets/sounds/toggle_off.ogg
  19. BIN
      Adventures in Lestoria/assets/sounds/toggle_on.ogg
  20. 11
      Adventures in Lestoria/olcPixelGameEngine.h
  21. 6
      Adventures in Lestoria/olcUTIL_DataFile.h
  22. BIN
      x64/Release/Adventures in Lestoria.exe

@ -350,6 +350,10 @@
<SubType>
</SubType>
</ClInclude>
<ClInclude Include="GameSettings.h">
<SubType>
</SubType>
</ClInclude>
<ClInclude Include="GameState.h" />
<ClInclude Include="InputDisplayComponent.h">
<SubType>
@ -594,6 +598,10 @@
<SubType>
</SubType>
</ClCompile>
<ClCompile Include="GameSettings.cpp">
<SubType>
</SubType>
</ClCompile>
<ClCompile Include="GameState.cpp" />
<ClCompile Include="InputHelper.cpp">
<SubType>

@ -459,6 +459,9 @@
<ClInclude Include="MenuDefinitions.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GameSettings.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="Player.cpp">
@ -803,6 +806,9 @@
<ClCompile Include="MenuDefinitions.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GameSettings.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="cpp.hint" />

@ -75,6 +75,7 @@ All rights reserved.
#ifndef __EMSCRIPTEN__
#include "discord.h"
#endif
#include "GameSettings.h"
INCLUDE_EMITTER_LIST
INCLUDE_ITEM_CATEGORIES
@ -298,6 +299,10 @@ bool AiL::OnUserCreate(){
bool AiL::OnUserUpdate(float fElapsedTime){
levelTime+=fElapsedTime;
if(GetMousePos()!=lastMousePos){
lastMouseMovement=0.f;
lastMousePos=GetMousePos();
}else lastMouseMovement+=fElapsedTime;
if(!GamePaused()){
GameState::STATE->OnUserUpdate(this);
}
@ -1163,7 +1168,7 @@ void AiL::RenderWorld(float fElapsedTime){
#pragma endregion
RenderTile(*tile,{255,255,255,uint8_t(255-tile->tileOpacity/TileGroup::FADE_TIME*TileGroup::FADE_AMT)});
float distToPlayer=geom2d::line<float>(player->GetPos(),tile->pos+vf2d{12,12}).length();
if(distToPlayer<24*3&&tile->tileOpacity>0&&tile->tileSheet.tileset->collision.find(tile->tileID)!=tile->tileSheet.tileset->collision.end()){
if(GameSettings::TerrainCollisionBoxesEnabled()&&distToPlayer<24*3&&tile->tileOpacity>0&&tile->tileSheet.tileset->collision.find(tile->tileID)!=tile->tileSheet.tileset->collision.end()){
geom2d::rect<float>collision=tile->tileSheet.tileset->collision[tile->tileID].collision;
distToPlayer/=4;
if(distToPlayer<1){distToPlayer=1;}
@ -1330,7 +1335,7 @@ void AiL::RenderWorld(float fElapsedTime){
#pragma endregion
RenderTile(*tile,{255,255,255,uint8_t(255-tile->tileOpacity/TileGroup::FADE_TIME*TileGroup::FADE_AMT)});
float distToPlayer=geom2d::line<float>(player->GetPos(),tile->pos+vf2d{12,12}).length();
if(distToPlayer<24*3&&tile->tileOpacity>0&&tile->tileSheet.tileset->collision.find(tile->tileID)!=tile->tileSheet.tileset->collision.end()){
if(GameSettings::TerrainCollisionBoxesEnabled()&&distToPlayer<24*3&&tile->tileOpacity>0&&tile->tileSheet.tileset->collision.find(tile->tileID)!=tile->tileSheet.tileset->collision.end()){
geom2d::rect<float>collision=tile->tileSheet.tileset->collision[tile->tileID].collision;
distToPlayer/=4;
if(distToPlayer<1){distToPlayer=1;}
@ -1657,6 +1662,7 @@ vf2d AiL::GetWorldMousePos(){
}
void AiL::SetupWorldShake(float duration){
if(!GameSettings::ScreenShakeEnabled())return;
worldShakeVel={13,-13};
worldShakeTime=duration;
worldShake=vf2d{player->GetPos()};
@ -3224,8 +3230,14 @@ void AiL::GetAnyMouseRelease(int32_t mouseButton){
#pragma endregion
GameState::STATE->GetAnyMouseRelease(mouseButton);
lastMouseMovement=0.f;
}
void AiL::GetAnyMousePress(int32_t mouseButton){
GameState::STATE->GetAnyMousePress(mouseButton);
lastMouseMovement=0.f;
}
const float AiL::LastMouseMovement()const{
return lastMouseMovement;
}

@ -160,6 +160,8 @@ private:
Pixel worldColor=WHITE;
std::function<Pixel(vi2d)>worldColorFunc=[](vi2d pos){return WHITE;};
std::map<std::string,std::vector<::ZoneData>>ZONE_LIST;
float lastMouseMovement=0.f; //Amount of time since the last time the cursor was moved or interacted with.
vi2d lastMousePos={};
void ValidateGameStatus();
#ifndef __EMSCRIPTEN__
@ -277,6 +279,8 @@ public:
//Returns the zones of any given stage
const std::map<std::string,std::vector<::ZoneData>>&GetZones(const std::string_view mapName)const;
void AddZone(const std::string_view zoneName,const ZoneData&zone);
//Returns the last time the mouse was moved or interacted with.
const float LastMouseMovement()const;
struct TileGroupData{
vi2d tilePos;

@ -39,6 +39,7 @@ All rights reserved.
#include "MenuComponent.h"
#include "AdventuresInLestoria.h"
#include "SoundEffect.h"
INCLUDE_game
@ -48,7 +49,7 @@ protected:
ToggleFunc onToggle;
inline void Toggle(){
checked=!checked;
SetChecked(!checked);
onToggle(ToggleFuncData{*Menu::menus[parentMenu],game,Menu::menus[parentMenu]->components[name],parentComponent,checked});
}
public:
@ -65,6 +66,11 @@ public:
inline void SetChecked(bool checked){
this->checked=checked;
if(checked){
SoundEffect::PlaySFX("Toggle On",SoundEffect::CENTERED);
}else{
SoundEffect::PlaySFX("Toggle Off",SoundEffect::CENTERED);
}
}
inline void DrawDecal(ViewPort&window,bool focused)override{

@ -0,0 +1,70 @@
#pragma region License
/*
License (OLC-3)
~~~~~~~~~~~~~~~
Copyright 2024 Joshua Sigona <sigonasr2@gmail.com>
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 "GameSettings.h"
bool GameSettings::screenShake=true;
bool GameSettings::rumble=true;
bool GameSettings::terrainCollisionBoxes=true;
bool GameSettings::keyboardAutoAim=false;
const bool GameSettings::ScreenShakeEnabled(){
return screenShake;
}
const bool GameSettings::RumbleEnabled(){
return rumble;
}
const bool GameSettings::TerrainCollisionBoxesEnabled(){
return terrainCollisionBoxes;
}
const bool GameSettings::KeyboardAutoAimEnabled(){
return keyboardAutoAim;
}
void GameSettings::SetScreenShake(bool screenShakeEnabled){
screenShake=screenShakeEnabled;
}
void GameSettings::SetRumble(bool rumbleEnabled){
rumble=rumbleEnabled;
}
void GameSettings::SetTerrainCollisionBoxes(bool terrainCollisionBoxesEnabled){
terrainCollisionBoxes=terrainCollisionBoxesEnabled;
}
void GameSettings::SetKeyboardAutoAim(bool autoAimEnabled){
keyboardAutoAim=autoAimEnabled;
}

@ -0,0 +1,54 @@
#pragma region License
/*
License (OLC-3)
~~~~~~~~~~~~~~~
Copyright 2024 Joshua Sigona <sigonasr2@gmail.com>
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
class GameSettings{
static bool screenShake;
static bool rumble;
static bool terrainCollisionBoxes;
static bool keyboardAutoAim;
public:
static const bool ScreenShakeEnabled();
static const bool RumbleEnabled();
static const bool TerrainCollisionBoxesEnabled();
static const bool KeyboardAutoAimEnabled();
static void SetScreenShake(bool screenShakeEnabled);
static void SetRumble(bool rumbleEnabled);
static void SetTerrainCollisionBoxes(bool terrainCollisionBoxesEnabled);
static void SetKeyboardAutoAim(bool autoAimEnabled);
};

@ -40,6 +40,7 @@ All rights reserved.
#include "AdventuresInLestoria.h"
#include "olcPGEX_Gamepad.h"
#include "Menu.h"
#include "GameSettings.h"
INCLUDE_game
INCLUDE_GFX
@ -564,6 +565,7 @@ const bool Input::AxesActive(){
}
void Input::StartVibration(){
if(!GameSettings::RumbleEnabled())return;
if(UsingGamepad()){
for(GamePad*gamepad:GamePad::getGamepads()){
if(gamepad->stillConnected){

@ -163,6 +163,12 @@ void Menu::Update(AiL*game){
}
for(auto&[key,button]:components){
if(button->F(A::RUMBLE_TIMER)>0.f){
button->F(A::RUMBLE_TIMER)=std::max(button->F(A::RUMBLE_TIMER)-game->GetElapsedTime(),0.f);
if(button->F(A::RUMBLE_TIMER)==0.f){
Input::StopVibration();
}
}
if(!button->disable||!button->disableOutsideWindow){
button->hovered=false;
}
@ -316,35 +322,37 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
}
}
for(auto&[input,data]:inputGroups){
if(Menu::alreadyClicked)break;
bool activated=false;
switch(input.GetEngageType()){
case Released:{
activated=input.GetGroup().Released();
}break;
case Pressed:{
activated=input.GetGroup().Pressed();
}break;
case PressedDAS:{
activated=input.GetGroup().PressedDAS();
}break;
case Held:{
activated=input.GetGroup().Held();
}break;
case Analog:{
activated=input.GetGroup().Analog()!=0.f;
}break;
[[unlikely]]default:ERR(std::format("WARNING! Unhandled input engage type {}! THIS SHOULD NOT BE HAPPENING!",int(input.GetEngageType())));
}
if(!Menu::UsingMouseNavigation()){
for(auto&[input,data]:inputGroups){
if(Menu::alreadyClicked)break;
bool activated=false;
switch(input.GetEngageType()){
case Released:{
activated=input.GetGroup().Released();
}break;
case Pressed:{
activated=input.GetGroup().Pressed();
}break;
case PressedDAS:{
activated=input.GetGroup().PressedDAS();
}break;
case Held:{
activated=input.GetGroup().Held();
}break;
case Analog:{
activated=input.GetGroup().Analog()!=0.f;
}break;
[[unlikely]]default:ERR(std::format("WARNING! Unhandled input engage type {}! THIS SHOULD NOT BE HAPPENING!",int(input.GetEngageType())));
}
if(activated){
auto&action=data.second;
if(std::holds_alternative<ButtonName>(action))Component<MenuComponent>(type,std::get<ButtonName>(action))->Click();
else
if(std::holds_alternative<std::function<void(MenuType)>>(action))std::get<std::function<void(MenuType)>>(action)(type);
else{
ERR("WARNING! Navigation data has an unrecognized type or is empty! This should not be happening!")
if(activated){
auto&action=data.second;
if(std::holds_alternative<ButtonName>(action))Component<MenuComponent>(type,std::get<ButtonName>(action))->Click();
else
if(std::holds_alternative<std::function<void(MenuType)>>(action))std::get<std::function<void(MenuType)>>(action)(type);
else{
ERR("WARNING! Navigation data has an unrecognized type or is empty! This should not be happening!")
}
}
}
}

@ -99,4 +99,5 @@ enum class Attribute{
KEYBIND,
ITEM_SLOT,
MERCHANT_ITEM_SLOT,
RUMBLE_TIMER, //NOTE: This timer automatically counts down inside of Menu.cpp!! Stops controller rumble when the timer ends.
};

@ -54,6 +54,7 @@ All rights reserved.
#include "olcPGEX_Gamepad.h"
#include "ProgressBar.h"
#include "MenuLabel.h"
#include "GameSettings.h"
INCLUDE_MONSTER_DATA
INCLUDE_MONSTER_LIST
@ -1293,7 +1294,7 @@ const vf2d Player::GetWorldAimingLocation(){
}
const vf2d Player::GetAimingLocation(){
if(Input::UsingGamepad()){
if(UsingAutoAim()){
float xAxis=0.f,yAxis=0.f;
#pragma region Manual Aiming
for(GamePad*gamepad:GamePad::getGamepads()){
@ -1334,4 +1335,7 @@ const vf2d Player::GetAimingLocation(){
}else{
return game->GetMousePos();
}
}
const bool Player::UsingAutoAim()const{
return (GameSettings::KeyboardAutoAimEnabled()&&game->LastMouseMovement()>=2.f)||Input::UsingGamepad();
}

@ -301,6 +301,7 @@ private:
//Set playerInvoked to false when you don't want a movement loop due to collisions.
//Typical usage is playerInvoked is true on first call, and playerInvoked is false on all subsequent chained calls.
bool _SetY(float y,const bool playerInvoked=true);
const bool UsingAutoAim()const;
protected:
const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F;
const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F;

@ -47,6 +47,7 @@ All rights reserved.
#include "LoadFileButton.h"
#include "Checkbox.h"
#include "InputDisplayComponent.h"
#include "GameSettings.h"
INCLUDE_game
@ -123,6 +124,12 @@ const void SaveFile::SaveGame(){
saveFile["Game Time"].SetReal(game->GetRuntime());
saveFile["TravelingMerchant"].SetString(std::string(Merchant::GetCurrentTravelingMerchant().GetKeyName()));
saveFile["Screen Shake"].SetBool(GameSettings::ScreenShakeEnabled());
saveFile["Controller Rumble"].SetBool(GameSettings::RumbleEnabled());
saveFile["Terrain Collision Boxes"].SetBool(GameSettings::TerrainCollisionBoxesEnabled());
saveFile["Keyboard Auto-Aim"].SetBool(GameSettings::KeyboardAutoAimEnabled());
saveFile["Fullscreen"].SetBool(game->IsFullscreen());
#pragma region Save Keyboard/Controller mappings
//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!
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;
@ -276,6 +283,12 @@ void SaveFile::LoadFile(){
game->GetPlayer()->RecalculateEquipStats();
if(loadFile.HasProperty("TravelingMerchant"))Merchant::SetTravelingMerchant(loadFile["TravelingMerchant"].GetString());
if(loadFile.HasProperty("Screen Shake"))GameSettings::SetScreenShake(loadFile["Screen Shake"].GetBool());
if(loadFile.HasProperty("Controller Rumble"))GameSettings::SetRumble(loadFile["Controller Rumble"].GetBool());
if(loadFile.HasProperty("Terrain Collision Boxes"))GameSettings::SetTerrainCollisionBoxes(loadFile["Terrain Collision Boxes"].GetBool());
if(loadFile.HasProperty("Keyboard Auto-Aim"))GameSettings::SetKeyboardAutoAim(loadFile["Keyboard Auto-Aim"].GetBool());
if(loadFile.HasProperty("Fullscreen"))game->SetFullScreen(loadFile["Fullscreen"].GetBool());
#pragma region Load Keyboard/Controller mappings
//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!
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;

@ -48,6 +48,7 @@ All rights reserved.
#include "Slider.h"
#include "Checkbox.h"
#include "InputDisplayComponent.h"
#include "GameSettings.h"
INCLUDE_DATA
INCLUDE_game
@ -59,7 +60,7 @@ void Menu::InitializeSettingsWindow(){
vf2d windowSize=WINDOW_SIZE-vf2d{28,28};
Menu*settingsWindow=CreateMenu(SETTINGS,CENTERED,windowSize);
settingsWindow->ADD("Unlock All Button",MenuComponent)(geom2d::rect<float>{{4,windowSize.y-12},{72,12}},"Unlock All",[](MenuFuncData data){
settingsWindow->ADD("Unlock All Button",MenuComponent)(geom2d::rect<float>{{4,windowSize.y},{72,12}},"Unlock All",[](MenuFuncData data){
for(auto&cp:State_OverworldMap::connections){
Unlock::UnlockArea(cp.map);
}
@ -85,14 +86,39 @@ void Menu::InitializeSettingsWindow(){
Menu::menus[SETTINGS]->F(A::LAST_SFX_VOLUME)=val;
}
})END;
settingsWindow->ADD("Terrain Collision Boxes Checkbox",Checkbox)(geom2d::rect<float>{{windowSize.x/2-88.f,84},{16.f,16.f}},[](ToggleFuncData data){
settingsWindow->ADD("Screen Shake Checkbox",Checkbox)(geom2d::rect<float>{{4.f,84},{16.f,16.f}},[](ToggleFuncData data){
GameSettings::SetScreenShake(data.checked);
return true;
},true)END;
settingsWindow->ADD("Terrain Collision Boxes Label",MenuLabel)(geom2d::rect<float>{{windowSize.x/2-68.f,84},{windowSize.x/2+54.f,16.f}},"Terrain Collision Boxes",1.f,ComponentAttr::SHADOW)END;
settingsWindow->ADD("Keyboard Play Auto-Aim Checkbox",Checkbox)(geom2d::rect<float>{{windowSize.x/2-88.f,104},{16.f,16.f}},[](ToggleFuncData data){
settingsWindow->ADD("Screen Shake Label",MenuLabel)(geom2d::rect<float>{{22.f,84},{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,104},{16.f,16.f}},[](ToggleFuncData data){
GameSettings::SetRumble(data.checked);
if(GameSettings::RumbleEnabled()){
Input::StartVibration();
data.component.lock()->F(A::RUMBLE_TIMER)=0.3f;
}else{
Input::StopVibration();
}
return true;
},true)END;
settingsWindow->ADD("Controller Rumble Label",MenuLabel)(geom2d::rect<float>{{22.f,104},{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,84},{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,84},{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,104},{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-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 Play Auto-Aim Label",MenuLabel)(geom2d::rect<float>{{windowSize.x/2+22.f,104},{windowSize.x/2-24.f,16.f}},"Aim Assist\n(No Mouse Players)",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
#ifndef __EMSCRIPTEN__
settingsWindow->ADD("Fullscreen Toggle Checkbox",Checkbox)(geom2d::rect<float>{{windowSize.x/2+4.f,124},{16.f,16.f}},[](ToggleFuncData data){
return true;
},false)END;
settingsWindow->ADD("Fullscreen Toggle Label",MenuLabel)(geom2d::rect<float>{{windowSize.x/2+22.f,124},{windowSize.x/2-24.f,16.f}},"Fullscreen",1.f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN)END;
#endif
#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!
@ -116,20 +142,20 @@ 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){
settingsWindow->ADD("Keyboard Bindings Button",MenuComponent)(geom2d::rect<float>{{28,144.f},vf2d{windowSize.x-32,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){
settingsWindow->ADD("Controller Bindings Button",MenuComponent)(geom2d::rect<float>{{28,172.f},vf2d{windowSize.x-32,24}},"Controller Bindings",[&](MenuFuncData data){
ChangeKeybindDisplayType(CONTROLLER);
Component<MenuLabel>(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<float>{vf2d{windowSize.x/2.f,windowSize.y}-vf2d{36,16},{72,12}},"Go Back",[](MenuFuncData data){
settingsWindow->ADD("Go Back",MenuComponent)(geom2d::rect<float>{vf2d{windowSize.x/2.f,windowSize.y}-vf2d{36,4},{72,12}},"Go Back",[](MenuFuncData data){
Menu::CloseMenu();
return true;
})END;

@ -9,6 +9,9 @@ January 1st
- Add screen shake and rumble as a toggle.
- Fullscreen toggle
> Implement fullscreen capabilities for the PGE.
- Toggle between Playstation / Xbox controller gamepad displays
- Rebind FACELEFT/FACERIGHT menu keys (as they are used constantly throughout menus and would need to be rebinded if the player wants). (Or make confirm/back not rebindable)
@ -31,8 +34,6 @@ January 31st
- Save window position and size
- Fullscreen toggle
- Condense stage track (loading times)
- If you enter the keyboard config menu and press a controller button, it cancels the request. If you enter the controller config menu and press a keyboard/mouse button, it also cancels the request.

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 3
#define VERSION_PATCH 0
#define VERSION_BUILD 7326
#define VERSION_BUILD 7344
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -181,6 +181,16 @@ Events
File[1] = slime_walk2.ogg, 10%
File[2] = slime_walk3.ogg, 10%
}
Toggle On
{
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = toggle_on.ogg, 100%
}
Toggle Off
{
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = toggle_off.ogg, 100%
}
Ursule Dead
{
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)

@ -1067,6 +1067,8 @@ namespace olc
const olc::vi2d& GetScreenPixelSize() const;
// Gets "screen" size
const olc::vi2d& GetScreenSize() const;
const bool IsFullscreen()const;
void SetFullScreen(bool bFullscreen);
// Gets any files dropped this frame
const std::vector<std::string>& GetDroppedFiles() const;
const olc::vi2d& GetDroppedFilesPoint() const;
@ -1352,7 +1354,6 @@ namespace olc
std::vector<std::tuple<olc::Key, std::string, std::string>> vKeyboardMap;
// State of keyboard
bool pKeyNewState[256] = { 0 };
bool pKeyOldState[256] = { 0 };
@ -2269,6 +2270,14 @@ namespace olc
const olc::vi2d& PixelGameEngine::GetScreenSize() const
{ return vScreenSize; }
const bool PixelGameEngine::IsFullscreen()const{
return bFullScreen;
}
void PixelGameEngine::SetFullScreen(bool bFullscreen){
//TODO: Implement fullscreen capabilities.
}
const olc::vi2d& PixelGameEngine::GetWindowMouse() const
{ return vMouseWindowPos; }

@ -135,6 +135,12 @@ namespace olc::utils
return GetString(nItem).starts_with('T')||GetString(nItem).starts_with('t');
}
// Sets the Boolean Value of a Property
inline void SetBool(const bool b, const size_t nItem = 0)
{
b?SetString("True",nItem):SetString("False",nItem);
}
// Sets the Integer Value of a Property (for a given index)
inline void SetInt(const int32_t n, const size_t nItem = 0)
{

Loading…
Cancel
Save