Setup framework for scrollbar and buttons in ScrollableWindowComponent. Fixed a bug where disabled buttons would not increment selection check loop. CreateMenu function instead of creating pointer and returning, so windows can add stuff to menus easily.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
INCLUDE_GFX
|
||||
typedef Attribute A;
|
||||
|
||||
Menu*Menu::InitializeInventoryWindow(){
|
||||
void Menu::InitializeInventoryWindow(){
|
||||
constexpr int invWidth=5;
|
||||
constexpr int initialInvHeight=3;
|
||||
|
||||
@@ -19,11 +19,11 @@ Menu*Menu::InitializeInventoryWindow(){
|
||||
constexpr int buttonSize=24;
|
||||
constexpr int totalSpacing=buttonSize+itemSpacing;
|
||||
|
||||
vf2d windowSize={totalSpacing*invWidth-itemSpacing+1,totalSpacing*(3+1)-itemSpacing+24};
|
||||
vf2d windowSize={totalSpacing*invWidth-itemSpacing+2+24,totalSpacing*(3+1)-itemSpacing+24}; //Need space for the button.
|
||||
|
||||
Menu*inventoryWindow=new Menu(CENTERED,windowSize);
|
||||
Menu*inventoryWindow=CreateMenu(INVENTORY,CENTERED,windowSize);
|
||||
|
||||
ScrollableWindowComponent*inventory=new ScrollableWindowComponent(INVENTORY,{{0,0},{windowSize.x,totalSpacing*3-itemSpacing}},nullptr,[](MenuFuncData data){});
|
||||
ScrollableWindowComponent*inventory=new ScrollableWindowComponent(INVENTORY,{{1,0},{windowSize.x,totalSpacing*3-itemSpacing}},nullptr,[](MenuFuncData data){});
|
||||
inventoryWindow->AddComponent("inventory",inventory);
|
||||
|
||||
MenuFunc useItemFunc=[](MenuFuncData data){
|
||||
@@ -43,6 +43,4 @@ Menu*Menu::InitializeInventoryWindow(){
|
||||
inventoryWindow->AddComponent("itemName",itemNameLabel);
|
||||
MenuLabel*itemDescriptionLabel=new MenuLabel{INVENTORY,geom2d::rect<float>(vf2d{2,initialInvHeight*totalSpacing+itemSpacing},{windowSize.x-4,windowSize.y-108}),"",true,true};
|
||||
inventoryWindow->AddComponent("itemDescription",itemDescriptionLabel);
|
||||
|
||||
return inventoryWindow;
|
||||
}
|
||||
Reference in New Issue
Block a user