Fixed item quantities being gone from decal versions of MenuItemItemButton components.
This commit is contained in:
@@ -115,7 +115,6 @@ void Menu::InitializeInventoryWindow(){
|
||||
inventoryWindow->ADD("Item Description Outline",MenuLabel)({{224,28},{inventoryDescriptionWidth,inventoryWindow->size.y-44}},"",1,LEFT_ALIGN|OUTLINE|BACKGROUND)END
|
||||
->decal=true;
|
||||
auto itemIcon=inventoryWindow->ADD("Item Icon",MenuItemItemButton)({{226+inventoryDescriptionWidth/2-24,30},{48,48}},Item::BLANK,MenuType::ENUM_END,DO_NOTHING,"","",IconButtonAttr::NOT_SELECTABLE)END;
|
||||
itemIcon->SetShowQuantity(false);
|
||||
itemIcon->decal=true;
|
||||
inventoryWindow->ADD("Item Name Label",MenuLabel)({{226,84},{inventoryDescriptionWidth-6,12}},"",0.75f,LEFT_ALIGN|SHADOW)END
|
||||
->decal=true;
|
||||
|
||||
+14
-11
@@ -144,17 +144,20 @@ protected:
|
||||
virtual inline void DrawDecal(Crawler*game,vf2d parentPos,bool focused)override{
|
||||
if(decal){
|
||||
MenuIconButton::DrawDecal(game,parentPos,focused);
|
||||
if(valid){
|
||||
int itemQuantity=Inventory::GetItemCount(invRef.at(inventoryIndex).Name()); //Normally we'd retrieve how many of this item we have from our inventory...However Monster Loot and Stage Loot inventories are special and hold their own inventory counts...
|
||||
if(&invRef==&Inventory::get("Monster Loot")||&invRef==&Inventory::get("Stage Loot")){
|
||||
itemQuantity=invRef.at(inventoryIndex).Amt(); //So the item quantity comes from the stack itself and not our main inventory.
|
||||
}
|
||||
std::string quantityText="x"+std::to_string(itemQuantity);
|
||||
vf2d textSize=vf2d(game->GetTextSizeProp(quantityText))*0.5;
|
||||
vf2d drawPos=parentPos+rect.pos+rect.size-textSize;
|
||||
if(PointWithinParent(this,drawPos)){
|
||||
game->DrawShadowStringDecal(drawPos,quantityText,WHITE,BLACK,{0.5,0.5},0.5);
|
||||
}
|
||||
if(selected!=-1){
|
||||
drawutil::DrawCrosshairDecal(game,{parentPos+rect.pos,rect.size},0);
|
||||
}
|
||||
}
|
||||
if(valid){
|
||||
int itemQuantity=Inventory::GetItemCount(invRef.at(inventoryIndex).Name()); //Normally we'd retrieve how many of this item we have from our inventory...However Monster Loot and Stage Loot inventories are special and hold their own inventory counts...
|
||||
if(&invRef==&Inventory::get("Monster Loot")||&invRef==&Inventory::get("Stage Loot")){
|
||||
itemQuantity=invRef.at(inventoryIndex).Amt(); //So the item quantity comes from the stack itself and not our main inventory.
|
||||
}
|
||||
std::string quantityText="x"+std::to_string(itemQuantity);
|
||||
vf2d textSize=vf2d(game->GetTextSizeProp(quantityText))*0.5;
|
||||
vf2d drawPos=parentPos+rect.pos+rect.size-textSize;
|
||||
if(PointWithinParent(this,drawPos)){
|
||||
game->DrawShadowStringDecal(drawPos,quantityText,WHITE,BLACK,{0.5,0.5},0.5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ protected:
|
||||
if(valid&&!hideQty){
|
||||
std::string quantityText="x"+std::to_string(itemRef.get().Amt());
|
||||
vf2d textSize=vf2d(game->GetTextSizeProp(quantityText))*0.5;
|
||||
vf2d drawPos=parentPos+rect.pos+rect.size-textSize;
|
||||
vf2d drawPos=Menu::menus[parentMenu]->pos+parentPos+rect.pos+rect.size-textSize;
|
||||
if(PointWithinParent(this,drawPos)){
|
||||
game->DrawShadowStringDecal(drawPos,quantityText,WHITE,BLACK,{0.5,0.5},0.5);
|
||||
}
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 1
|
||||
#define VERSION_BUILD 3803
|
||||
#define VERSION_BUILD 3809
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
||||
Reference in New Issue
Block a user