Begin work on Level Completion controller compatibility. Add in inventory scrollable window helper navigation macros to make coding wrapping functionality easier. Release Build 7010.

pull/35/head
sigonasr2 10 months ago
parent 5169670b76
commit 52a01d04ad
  1. 251
      Adventures in Lestoria/InventoryConsumableWindow.cpp
  2. 8
      Adventures in Lestoria/Key.cpp
  3. 2
      Adventures in Lestoria/Key.h
  4. 73
      Adventures in Lestoria/LevelCompleteWindow.cpp
  5. 8
      Adventures in Lestoria/Menu.cpp
  6. 2
      Adventures in Lestoria/Version.h
  7. BIN
      x64/Release/Adventures in Lestoria.exe

@ -152,121 +152,166 @@ void Menu::InitializeConsumableInventoryWindow(){
}},
{"inventory",{
.up=[](MenuType type,Data&returnData){
auto&selection=Menu::menus[type]->GetSelection();
auto&itemsList=Component<InventoryScrollableWindowComponent>(type,"inventory")->GetComponents();
auto itemsWindow=Component<InventoryScrollableWindowComponent>(type,"inventory");
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return comp.lock()==selection.lock();});
if(itemsList.size()>0){
if(component==itemsList.end()){
//Set the selected button to the last element in the list.
returnData=itemsList.back();
}else{
int invWidth=int((itemsWindow->rect.size.x-12)/(float(itemsWindow->options.size.x)+itemsWindow->options.padding));
std::weak_ptr<MenuItemButton>selectedButton=DYNAMIC_POINTER_CAST<MenuItemButton>(*component);
int newRowIndex=selectedButton.lock()->inventoryIndex-invWidth; //Moving up moves the cursor up an entire row.
if(newRowIndex<0){
//This means we have to wrap around.
returnData="OK Button";
return;
}
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex));
//Select the component that matches this new number.
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return DYNAMIC_POINTER_CAST<MenuItemButton>(comp)->inventoryIndex==newRowIndex;});
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex));
returnData=*component;
}
}else{
#pragma region Inventory Wrapping Handling Up Macros
//Make sure before using this you have #define SUBCLASS with the children class for this inventory scrollable window component!
#define DetectInventory(menuClass,menuType,inventoryComponentName) \
auto&selection=Menu::menus[menuType]->GetSelection(); \
auto&itemsList=Component<menuClass>(menuType,inventoryComponentName)->GetComponents(); \
auto itemsWindow=Component<menuClass>(menuType,inventoryComponentName); \
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return comp.lock()==selection.lock();}); \
if(itemsList.size()>0){ \
if(component==itemsList.end()){ \
/*Set the selected button to the last element in the list.*/ \
returnData=itemsList.back(); \
}else{ \
int invWidth=int((itemsWindow->rect.size.x-12)/(float(itemsWindow->options.size.x)+itemsWindow->options.padding)); \
std::weak_ptr<SUBCLASS>selectedButton=DYNAMIC_POINTER_CAST<SUBCLASS>(*component); \
int newRowIndex=selectedButton.lock()->inventoryIndex-invWidth; /*Moving up moves the cursor up an entire row.*/ \
if(newRowIndex<0){
#define DefaultBehavior \
return; \
} \
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex)); \
/*Select the component that matches this new number.*/ \
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return DYNAMIC_POINTER_CAST<SUBCLASS>(comp)->inventoryIndex==newRowIndex;}); \
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex)); \
returnData=*component; \
} \
} \
else
#define DEFAULT_WRAPPING_BEHAVIOR newRowIndex=itemsList.size()-1;
#pragma endregion
#define SUBCLASS MenuItemButton
DetectInventory(InventoryScrollableWindowComponent,type,"inventory")
{ //This means we have to wrap around. We have access to itemsList if we needed to point to a specific item in the inventory.
//By returning here, you are processing returnData yourself. Otherwise manipulate newRowIndex to point to an item in the itemsList when wrapping.
returnData="OK Button";
return;
}
DefaultBehavior{ //When nothing is found...
returnData="OK Button";
}
},
.down=[](MenuType type,Data&returnData){
auto&selection=Menu::menus[type]->GetSelection();
auto&itemsList=Component<InventoryScrollableWindowComponent>(type,"inventory")->GetComponents();
auto itemsWindow=Component<InventoryScrollableWindowComponent>(type,"inventory");
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return comp.lock()==selection.lock();});
if(itemsList.size()>0){
if(component==itemsList.end()){
//Set the selected button to the first element in the list.
returnData=itemsList.front();
}else{
int invWidth=int((itemsWindow->rect.size.x-12)/(float(itemsWindow->options.size.x)+itemsWindow->options.padding));
std::weak_ptr<MenuItemButton>selectedButton=DYNAMIC_POINTER_CAST<MenuItemButton>(*component);
int newRowIndex=selectedButton.lock()->inventoryIndex+invWidth; //Moving down moves the cursor down an entire row.
if(newRowIndex>=itemsList.size()){
int currentRow=newRowIndex/invWidth;
//The logic here is, if we clamp this row index to the last possible index and we're still on the same row, it means there is at least an item on this row. So we go to that instead.
newRowIndex=std::clamp(newRowIndex,0,int(itemsList.size()-1));
int newRow=newRowIndex/invWidth;
if(currentRow!=newRow){ //This means we are on a different row, so the row we went down on didn't have any items. Simply drop down to the OK Button.
returnData="OK Button";
return;
}
}
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex));
//Select the component that matches this new number.
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return DYNAMIC_POINTER_CAST<MenuItemButton>(comp)->inventoryIndex==newRowIndex;});
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex));
returnData=*component;
}
}else{
#pragma region Inventory Wrapping Handling Down Macros
//Make sure before using this you have #define SUBCLASS with the children class for this inventory scrollable window component!
#define DetectInventory(menuClass,menuType,inventoryComponentName) \
auto&selection=Menu::menus[menuType]->GetSelection(); \
auto&itemsList=Component<menuClass>(menuType,inventoryComponentName)->GetComponents(); \
auto itemsWindow=Component<menuClass>(menuType,inventoryComponentName); \
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return comp.lock()==selection.lock();}); \
if(itemsList.size()>0){ \
if(component==itemsList.end()){ \
/*Set the selected button to the last element in the list.*/ \
returnData=itemsList.front();\
}else{ \
int invWidth=int((itemsWindow->rect.size.x-12)/(float(itemsWindow->options.size.x)+itemsWindow->options.padding)); \
std::weak_ptr<SUBCLASS>selectedButton=DYNAMIC_POINTER_CAST<SUBCLASS>(*component); \
int newRowIndex=selectedButton.lock()->inventoryIndex+invWidth; /*Moving down moves the cursor down an entire row.*/ \
if(newRowIndex>=itemsList.size()){ \
int currentRow=newRowIndex/invWidth; \
/*The logic here is, if we clamp this row index to the last possible index and we're still on the same row, it means there is at least an item on this row. So we go to that instead.*/ \
newRowIndex=std::clamp(newRowIndex,0,int(itemsList.size()-1)); \
int newRow=newRowIndex/invWidth; \
if(currentRow!=newRow) //This means we are on a different row, so the row we went down on didn't have any items. Simply drop down to the OK Button.
#define DefaultBehavior \
} \
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex)); \
/*Select the component that matches this new number.*/ \
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return DYNAMIC_POINTER_CAST<SUBCLASS>(comp)->inventoryIndex==newRowIndex;}); \
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex)); \
returnData=*component; \
} \
} \
else
#define DEFAULT_WRAPPING_BEHAVIOR newRowIndex=0;
#pragma endregion
#define SUBCLASS MenuItemButton
DetectInventory(InventoryScrollableWindowComponent,type,"inventory")
{ //This means we have to wrap around. We have access to itemsList if we needed to point to a specific item in the inventory.
//By returning here, you are processing returnData yourself. Otherwise manipulate newRowIndex to point to an item in the itemsList when wrapping.
returnData="OK Button";
return;
}
DefaultBehavior{ //When nothing is found...
returnData="OK Button";
}
},
.left=[](MenuType type,Data&returnData){
auto&selection=Menu::menus[type]->GetSelection();
auto&itemsList=Component<InventoryScrollableWindowComponent>(type,"inventory")->GetComponents();
auto itemsWindow=Component<InventoryScrollableWindowComponent>(type,"inventory");
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return comp.lock()==selection.lock();});
if(itemsList.size()>0){
if(component==itemsList.end()){
//Set the selected button to the last element in the list.
returnData=itemsList.back();
}else{
int invWidth=int((itemsWindow->rect.size.x-12)/(float(itemsWindow->options.size.x)+itemsWindow->options.padding));
std::weak_ptr<MenuItemButton>selectedButton=DYNAMIC_POINTER_CAST<MenuItemButton>(*component);
int rowBaseIndex=(selectedButton.lock()->inventoryIndex/invWidth)*invWidth;
int newRowIndex=selectedButton.lock()->inventoryIndex-1;
if(newRowIndex<rowBaseIndex)newRowIndex+=invWidth;
newRowIndex=std::min(int(itemsList.size())-1,newRowIndex);
if(newRowIndex<0){
//This means we have to wrap around.
newRowIndex+=itemsList.size();
}
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex));
//Select the component that matches this new number.
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return DYNAMIC_POINTER_CAST<MenuItemButton>(comp)->inventoryIndex==newRowIndex;});
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex));
returnData=*component;
}
}else{
#pragma region Inventory Wrapping Handling Left Macros
#define DetectInventory(menuClass,menuType,inventoryComponentName) \
auto&selection=Menu::menus[menuType]->GetSelection(); \
auto&itemsList=Component<menuClass>(menuType,inventoryComponentName)->GetComponents(); \
auto itemsWindow=Component<menuClass>(menuType,inventoryComponentName); \
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return comp.lock()==selection.lock();}); \
if(itemsList.size()>0){ \
if(component==itemsList.end()){ \
/*Set the selected button to the last element in the list.*/ \
returnData=itemsList.back(); \
}else{ \
int invWidth=int((itemsWindow->rect.size.x-12)/(float(itemsWindow->options.size.x)+itemsWindow->options.padding)); \
std::weak_ptr<SUBCLASS>selectedButton=DYNAMIC_POINTER_CAST<SUBCLASS>(*component); \
int rowBaseIndex=(selectedButton.lock()->inventoryIndex/invWidth)*invWidth; \
int newRowIndex=selectedButton.lock()->inventoryIndex-1; \
if(newRowIndex<rowBaseIndex)
#define DefaultBehavior \
newRowIndex=std::min(int(itemsList.size())-1,newRowIndex); \
if(newRowIndex<0)newRowIndex+=itemsList.size(); \
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex)); \
/*Select the component that matches this new number.*/ \
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return DYNAMIC_POINTER_CAST<SUBCLASS>(comp)->inventoryIndex==newRowIndex;}); \
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex)); \
returnData=*component; \
} \
}else
#define DEFAULT_WRAPPING_BEHAVIOR newRowIndex+=invWidth;
#pragma endregion
#define SUBCLASS MenuItemButton
DetectInventory(InventoryScrollableWindowComponent,type,"inventory")
{ //This means we have to wrap around. We have access to itemsList if we needed to point to a specific item in the inventory.
//By returning here, you are processing returnData yourself. Otherwise manipulate newRowIndex to point to an item in the itemsList when wrapping.
DEFAULT_WRAPPING_BEHAVIOR;
}
DefaultBehavior{ //When nothing is found...
returnData="OK Button";
}
},
.right=[](MenuType type,Data&returnData){
auto&selection=Menu::menus[type]->GetSelection();
auto&itemsList=Component<InventoryScrollableWindowComponent>(type,"inventory")->GetComponents();
auto itemsWindow=Component<InventoryScrollableWindowComponent>(type,"inventory");
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return comp.lock()==selection.lock();});
if(itemsList.size()>0){
if(component==itemsList.end()){
//Set the selected button to the first element in the list.
returnData=itemsList.front();
}else{
int invWidth=int((itemsWindow->rect.size.x-12)/(float(itemsWindow->options.size.x)+itemsWindow->options.padding));
std::weak_ptr<MenuItemButton>selectedButton=DYNAMIC_POINTER_CAST<MenuItemButton>(*component);
int rowBaseIndex=(selectedButton.lock()->inventoryIndex/invWidth)*invWidth;
int newRowIndex=selectedButton.lock()->inventoryIndex+1;
if(newRowIndex>rowBaseIndex+invWidth-1)newRowIndex-=invWidth;
newRowIndex=std::clamp(newRowIndex,0,int(itemsList.size()-1));
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex));
//Select the component that matches this new number.
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return DYNAMIC_POINTER_CAST<MenuItemButton>(comp)->inventoryIndex==newRowIndex;});
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex));
returnData=*component;
}
}else{
#pragma region Inventory Wrapping Handling Right Macros
#define DetectInventory(menuClass,menuType,inventoryComponentName) \
auto&selection=Menu::menus[menuType]->GetSelection(); \
auto&itemsList=Component<menuClass>(menuType,inventoryComponentName)->GetComponents(); \
auto itemsWindow=Component<menuClass>(menuType,inventoryComponentName); \
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return comp.lock()==selection.lock();}); \
if(itemsList.size()>0){ \
if(component==itemsList.end()){ \
/*Set the selected button to the last element in the list.*/ \
returnData=itemsList.front(); \
}else{ \
int invWidth=int((itemsWindow->rect.size.x-12)/(float(itemsWindow->options.size.x)+itemsWindow->options.padding)); \
std::weak_ptr<SUBCLASS>selectedButton=DYNAMIC_POINTER_CAST<SUBCLASS>(*component); \
int rowBaseIndex=(selectedButton.lock()->inventoryIndex/invWidth)*invWidth; \
int newRowIndex=selectedButton.lock()->inventoryIndex+1; \
if(newRowIndex>rowBaseIndex+invWidth-1)
#define DefaultBehavior \
newRowIndex=std::clamp(newRowIndex,0,int(itemsList.size()-1)); \
newRowIndex=std::min(int(itemsList.size())-1,newRowIndex); \
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex)); \
/*Select the component that matches this new number.*/ \
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return DYNAMIC_POINTER_CAST<SUBCLASS>(comp)->inventoryIndex==newRowIndex;}); \
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex)); \
returnData=*component; \
} \
}else
#define DEFAULT_WRAPPING_BEHAVIOR newRowIndex-=invWidth;
#pragma endregion
#define SUBCLASS MenuItemButton
DetectInventory(InventoryScrollableWindowComponent,type,"inventory")
{ //This means we have to wrap around. We have access to itemsList if we needed to point to a specific item in the inventory.
//By returning here, you are processing returnData yourself. Otherwise manipulate newRowIndex to point to an item in the itemsList when wrapping.
DEFAULT_WRAPPING_BEHAVIOR;
}
DefaultBehavior{ //When nothing is found...
returnData="OK Button";
}
},

@ -262,14 +262,14 @@ const float InputGroup::Analog()const{
return 0.f;
}
const float InputGroup::AnalogDAS(){
const float InputGroup::AnalogDAS(const float threshold){
for(Input input:keys){
float analogVal=input.Analog();
if(analogVal!=0.f&&initialHoldDownTime==0.f){
if(abs(analogVal)>=threshold&&initialHoldDownTime==0.f){
initialHoldDownTime="Interface.InitialScrollDelay"_F;
return analogVal;
}else
if(analogVal!=0.f&&initialHoldDownTime>0.f){
if(abs(analogVal)>=threshold&&initialHoldDownTime>0.f){
initialHoldDownTime-=game->GetElapsedTime();
if(initialHoldDownTime<=0.f){
holdDownTime="Interface.ScrollDelay"_F;
@ -277,7 +277,7 @@ const float InputGroup::AnalogDAS(){
}
return 0.f;
}else
if(analogVal!=0.f&&holdDownTime>0.f){
if(abs(analogVal)>=threshold&&holdDownTime>0.f){
holdDownTime-=game->GetElapsedTime();
if(holdDownTime<=0.f){
holdDownTime="Interface.ScrollDelay"_F;

@ -113,7 +113,7 @@ public:
const bool Held()const;
const bool Released();
const float Analog()const;
const float AnalogDAS();
const float AnalogDAS(const float threshold=0.2f);
std::string GetDisplayName();
//Draws an input display with accompanying text centered at given position.
void DrawInput(const std::variant<AiL*const,TileTransformedView*const>renderer,const vf2d pos,const std::string_view displayText,const uint8_t alpha)const;

@ -79,4 +79,77 @@ void Menu::InitializeLevelCompleteWindow(){
levelCompleteWindow->ADD("Stage Loot Popup Item Name",PopupMenuLabel)(geom2d::rect<float>{{0,32},{windowSize.size.x-80.f,12}},"",1.0f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END;
levelCompleteWindow->ADD("Stage Loot Popup Item Description",PopupMenuLabel)(geom2d::rect<float>{{0,44},{windowSize.size.x-80.f,60}},"",1.0f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END;
levelCompleteWindow->SetupKeyboardNavigation(
[](MenuType type,Data&returnData){ //On Open
auto monsterLoot=Component<InventoryScrollableWindowComponent>(type,"Monster Loot Window");
auto stageLoot=Component<InventoryScrollableWindowComponent>(type,"Stage Loot Window");
if(monsterLoot->GetComponents().size()>0){
returnData=monsterLoot->GetComponents().front();
}else
if(stageLoot->GetComponents().size()>0){
returnData=stageLoot->GetComponents().front();
}else{
returnData="Next Button";
}
},
{ //Button Key
{{game->KEY_SHOULDER,Pressed},{"Scroll",[](MenuType type){}}},
{{game->KEY_FASTSCROLLDOWN,PressedDAS,InputEngageGroup::NOT_VISIBLE},{"Scroll",[](MenuType type){
auto selection=Menu::menus[type]->GetSelection();
if(!selection.expired()){
auto parentComponent=DYNAMIC_POINTER_CAST<InventoryScrollableWindowComponent>(selection.lock()->parentComponent);
int invWidth=int((parentComponent->rect.size.x-12)/(float(parentComponent->options.size.x)+parentComponent->options.padding));
parentComponent->IncreaseSelectionIndex(invWidth*3.f);
}
}}},
{{game->KEY_FASTSCROLLUP,PressedDAS,InputEngageGroup::NOT_VISIBLE},{"Scroll",[](MenuType type){
auto selection=Menu::menus[type]->GetSelection();
if(!selection.expired()){
auto parentComponent=DYNAMIC_POINTER_CAST<InventoryScrollableWindowComponent>(selection.lock()->parentComponent);
int invWidth=int((parentComponent->rect.size.x-12)/(float(parentComponent->options.size.x)+parentComponent->options.padding));
parentComponent->IncreaseSelectionIndex(invWidth*-3.f);
}
}}},
{game->KEY_SCROLL,{"View Items",[](MenuType type){}}},
{game->KEY_START,{"Continue",[](MenuType type){}}},
}
,{ //Button Navigation Rules
{"Monster Loot Window",{
.up=[](MenuType type,Data&returnData){
auto&selection=Menu::menus[type]->GetSelection();
auto&itemsList=Component<InventoryScrollableWindowComponent>(type,"Monster Loot Window")->GetComponents();
auto itemsWindow=Component<InventoryScrollableWindowComponent>(type,"Monster Loot Window");
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return comp.lock()==selection.lock();});
if(itemsList.size()>0){
if(component==itemsList.end()){
//Set the selected button to the last element in the list.
returnData=itemsList.back();
}else{
int invWidth=int((itemsWindow->rect.size.x-12)/(float(itemsWindow->options.size.x)+itemsWindow->options.padding));
std::weak_ptr<MenuItemButton>selectedButton=DYNAMIC_POINTER_CAST<MenuItemButton>(*component);
int newRowIndex=selectedButton.lock()->inventoryIndex-invWidth; //Moving up moves the cursor up an entire row.
if(newRowIndex<0){
//This means we have to wrap around.
returnData="OK Button";
return;
}
if(newRowIndex<0||newRowIndex>=itemsList.size())ERR(std::format("New Row Index ended up out-of-bounds! newRowIndex={}. THIS SHOULD NOT BE HAPPENING!",newRowIndex));
//Select the component that matches this new number.
auto component=std::find_if(itemsList.begin(),itemsList.end(),[&](auto&comp){return DYNAMIC_POINTER_CAST<MenuItemButton>(comp)->inventoryIndex==newRowIndex;});
if(component==itemsList.end())ERR(std::format("WARNING! Could not find row index {} in items list while navigating! THIS SHOULD NOT BE HAPPENING!",newRowIndex));
returnData=*component;
}
}else{
returnData="OK Button";
}
},
.down="Load Game Button",}},
{"Load Game Button",{
.up="New Game Button",
.down="Quit Game Button",}},
{"Quit Game Button",{
.up="Load Game Button",
.down="New Game Button",}},
});
}

@ -346,7 +346,7 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
}
if(navigationGroups.count(selectionButtonName)){
Navigation nav=navigationGroups[selectionButtonName];
if(game->KEY_UP.PressedDAS()||game->KEY_SCROLLUP.AnalogDAS()<-0.2f){
if(game->KEY_UP.PressedDAS()||game->KEY_SCROLLUP.AnalogDAS(0.5f)<-0.5f){
SetMouseNavigation(false);
if(std::holds_alternative<std::string>(nav.up)&&std::get<std::string>(nav.up).length()>0)SetSelection(std::string_view(std::get<std::string>(nav.up)));
else
@ -356,7 +356,7 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
SetSelection(returnData);
}
}
if(game->KEY_DOWN.PressedDAS()||game->KEY_SCROLLDOWN.AnalogDAS()>0.2f){
if(game->KEY_DOWN.PressedDAS()||game->KEY_SCROLLDOWN.AnalogDAS(0.5f)>0.5f){
SetMouseNavigation(false);
if(std::holds_alternative<std::string>(nav.down)&&std::get<std::string>(nav.down).length()>0)SetSelection(std::string_view(std::get<std::string>(nav.down)));
else
@ -366,7 +366,7 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
SetSelection(returnData);
}
}
if(game->KEY_LEFT.PressedDAS()||game->KEY_SCROLLLEFT.AnalogDAS()<-0.2f){
if(game->KEY_LEFT.PressedDAS()||game->KEY_SCROLLLEFT.AnalogDAS(0.5f)<-0.5f){
SetMouseNavigation(false);
if(std::holds_alternative<std::string>(nav.left)&&std::get<std::string>(nav.left).length()>0)SetSelection(std::string_view(std::get<std::string>(nav.left)));
else
@ -376,7 +376,7 @@ void Menu::KeyboardButtonNavigation(AiL*game,vf2d menuPos){
SetSelection(returnData);
}
}
if(game->KEY_RIGHT.PressedDAS()||game->KEY_SCROLLRIGHT.AnalogDAS()>0.2f){
if(game->KEY_RIGHT.PressedDAS()||game->KEY_SCROLLRIGHT.AnalogDAS(0.5f)>0.5f){
SetMouseNavigation(false);
if(std::holds_alternative<std::string>(nav.right)&&std::get<std::string>(nav.right).length()>0)SetSelection(std::string_view(std::get<std::string>(nav.right)));
else

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

Loading…
Cancel
Save