Update labels for different zones when clicking through them.

pull/28/head
sigonasr2 1 year ago
parent 4c6be02543
commit 2594078794
  1. 7
      Crawler/EncountersSpawnListScrollableWindowComponent.h
  2. 6
      Crawler/MenuComponent.cpp
  3. 1
      Crawler/MenuComponent.h
  4. 2
      Crawler/State_OverworldMap.cpp
  5. 2
      Crawler/Version.h
  6. 3
      Crawler/safemap.h

@ -14,6 +14,13 @@ public:
inline EncountersSpawnListScrollableWindowComponent(MenuType parent,geom2d::rect<float>rect,ComponentAttr attributes=ComponentAttr::BACKGROUND|ComponentAttr::OUTLINE)
:ScrollableWindowComponent(parent,rect,attributes){}
virtual inline void UpdateSpawns(std::vector<int>&spawns){
Menu::menus.at(parentMenu)->components.erase_if([&](auto key){
if(key.first.starts_with("Spawn ")){
std::erase_if(components,[&](MenuComponent*component){return key.second==component;});
delete key.second;
return true;
}
return false;});
int offsetY=0;
vf2d parentPos=Menu::menus.at(OVERWORLD_LEVEL_SELECT)->pos;
vf2d parentSize=Menu::menus.at(OVERWORLD_LEVEL_SELECT)->size;

@ -125,4 +125,8 @@ void MenuComponent::Enable(bool enabled){
disabled=!enabled;
};
void MenuComponent::Cleanup(){}
void MenuComponent::Cleanup(){}
std::string MenuComponent::GetName(){
return name;
}

@ -69,6 +69,7 @@ public:
//Called whenever an inventory slot gets updated, whether it's adding or removing an item.
virtual void OnInventorySlotsUpdate(ITCategory cat);
std::string GetLabel();
std::string GetName();
void Enable(bool enabled);
virtual void Cleanup();
};

@ -65,6 +65,8 @@ void State_OverworldMap::OnUserUpdate(Crawler*game){
}else{
game->GetPlayer()->UpdateWalkingAnimation(LEFT);
}
COMPONENT(MenuLabel,OVERWORLD_LEVEL_SELECT,"Stage Label")->SetLabel(currentConnectionPoint->name);
COMPONENT(EncountersSpawnListScrollableWindowComponent,OVERWORLD_LEVEL_SELECT,"Spawns List")->UpdateSpawns(currentConnectionPoint->spawns);
break;
}
}

@ -2,7 +2,7 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 1
#define VERSION_BUILD 2774
#define VERSION_BUILD 2783
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -55,6 +55,9 @@ public:
auto erase(std::map<T,O>::iterator it){
return map.erase(it);
}
auto erase_if(std::function<bool(std::pair<T,O>)>lambda){
return std::erase_if(map,lambda);
}
};
//A class that has an initialization lock so that when the lock is activated, any further gets that are missing items in it will report themselves for easier debugging detection.

Loading…
Cancel
Save