Add an update icon call to SetItem for MenuItemItemComponent
This commit is contained in:
@@ -95,7 +95,9 @@ public:
|
||||
MenuItemButton*itemButton=dynamic_cast<MenuItemButton*>(component);
|
||||
if(itemButton){
|
||||
itemButton->SetCompactDescriptions(compact);
|
||||
}
|
||||
}else{
|
||||
ERR("WARNING! Attempting to cast a button that isn't a MenuItemButton!");
|
||||
}
|
||||
}
|
||||
}
|
||||
protected:
|
||||
|
||||
@@ -202,14 +202,11 @@ void Menu::Update(Crawler*game){
|
||||
itemHovered=true;
|
||||
selection.y=key;
|
||||
selection.x=index;
|
||||
goto selected;
|
||||
}
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
selected:
|
||||
int a;
|
||||
}
|
||||
|
||||
if(itemHovered&&draggingComponent==nullptr&&selection!=vi2d{-1,-1}&&(((!UsingMouseNavigation()&&(game->GetKey(ENTER).bHeld)||game->GetKey(SPACE).bHeld))||game->GetMouse(Mouse::LEFT).bHeld)){
|
||||
|
||||
@@ -73,6 +73,7 @@ public:
|
||||
return itemRef.get();
|
||||
}
|
||||
inline Item&SetItem(Item&newItem){
|
||||
UpdateIcon();
|
||||
return itemRef=std::reference_wrapper<Item>(newItem);
|
||||
}
|
||||
inline void SetShowQuantity(bool show){
|
||||
@@ -94,19 +95,20 @@ protected:
|
||||
virtual inline void OnHover()override{
|
||||
UpdateLabel();
|
||||
}
|
||||
void UpdateLabel(){
|
||||
if(itemRef.get().IsBlank())return;
|
||||
inline void UpdateLabel(){
|
||||
std::string labelNameText;
|
||||
std::string labelDescriptionText;
|
||||
if(valid){
|
||||
icon=itemRef.get().Decal();
|
||||
labelNameText=itemRef.get().Name();
|
||||
labelDescriptionText=itemRef.get().Description(compact);
|
||||
}else{
|
||||
|
||||
if(itemRef.get().IsBlank()){
|
||||
icon=nullptr;
|
||||
labelNameText="";
|
||||
labelDescriptionText="";
|
||||
return;
|
||||
}
|
||||
|
||||
icon=itemRef.get().Decal();
|
||||
labelNameText=itemRef.get().Name();
|
||||
labelDescriptionText=itemRef.get().Description(compact);
|
||||
if(itemNameLabelName!=""){
|
||||
Component<MenuLabel>(parentMenu,itemNameLabelName)->label=labelNameText;
|
||||
Component<MenuLabel>(parentMenu,itemNameLabelName)->Enable(true);
|
||||
@@ -135,4 +137,12 @@ protected:
|
||||
window.DrawShadowStringDecal(drawPos,quantityText,WHITE,BLACK,quantityTextScale,quantityTextScale.x);
|
||||
}
|
||||
}
|
||||
private:
|
||||
inline void UpdateIcon(){
|
||||
if(itemRef.get().IsBlank()){
|
||||
icon=nullptr;
|
||||
return;
|
||||
}
|
||||
icon=itemRef.get().Decal();
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 1
|
||||
#define VERSION_BUILD 4019
|
||||
#define VERSION_BUILD 4023
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
||||
Reference in New Issue
Block a user