Refactored dynamic cast to do internal error checking. Refactored all inventory and button slot update functions in menu components so they no longer require virtual dispatch when all we require is some passing of lamba functions to update inventories.

This commit is contained in:
2023-12-27 20:40:01 -06:00
parent f2e3405b5b
commit bd066ee787
22 changed files with 430 additions and 217 deletions
+15
View File
@@ -40,6 +40,7 @@ All rights reserved.
#include "Crawler.h"
#include "MenuItemItemButton.h"
#include "PlayerMoneyLabel.h"
#include "RowInventoryScrollableWindowComponent.h"
INCLUDE_game
INCLUDE_ITEM_CATEGORIES
@@ -83,6 +84,20 @@ void Menu::InitializeBlacksmithCraftingWindow(){
})END;
armorTab->selectionType=SelectionType::HIGHLIGHT;
auto inventoryDisplay=blacksmithWindow->ADD("Weapon Inventory Display",RowInventoryScrollableWindowComponent)({{2,28},{220,blacksmithWindow->size.y-44}},"Item Name Label","Item Description Label",
[](MenuFuncData data){
return true;
},
[](MenuFuncData data){
return true;
},
[](MenuFuncData data){
return true;
},
InventoryCreator::RowPlayerWeapons_InventoryUpdate,
{.padding=1,.size={207,28}}
)END;
#pragma region Inventory Description
float inventoryDescriptionWidth=blacksmithWindow->pos.x+blacksmithWindow->size.x-26-224;
blacksmithWindow->ADD("Item Description Outline",MenuLabel)({{224,28},{inventoryDescriptionWidth,blacksmithWindow->size.y-44}},"",1,ComponentAttr::LEFT_ALIGN|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END;