diff --git a/Crawler/CharacterInfoWindow.cpp b/Crawler/CharacterInfoWindow.cpp
new file mode 100644
index 00000000..3d7aa3df
--- /dev/null
+++ b/Crawler/CharacterInfoWindow.cpp
@@ -0,0 +1,12 @@
+#pragma once
+#include "Crawler.h"
+#include "DEFINES.h"
+#include "Menu.h"
+
+INCLUDE_game
+typedef Attribute A;
+
+void Menu::InitializeCharacterInfoWindow(){
+ Menu*characterInfoWindow=CreateMenu(INVENTORY,CENTERED,game->GetScreenSize()-vi2d{4,4});
+
+}
\ No newline at end of file
diff --git a/Crawler/Crawler.cpp b/Crawler/Crawler.cpp
index 80cec8ae..dd1e06aa 100644
--- a/Crawler/Crawler.cpp
+++ b/Crawler/Crawler.cpp
@@ -105,6 +105,11 @@ bool Crawler::OnUserCreate(){
camera.EnableWorldBoundary(false);
ItemInfo::InitializeItems();
+
+ InitializeGraphics();
+
+ Menu::InitializeMenus();
+
Inventory::AddItem("Small Health Potion",16);
Inventory::AddItem("Large Health Potion",3);
Inventory::AddItem("Medium Mana Potion",1);
@@ -121,20 +126,9 @@ bool Crawler::OnUserCreate(){
Inventory::AddItem("Dummy Item 11",8);
Inventory::AddItem("Dummy Item 12",3);
Inventory::AddItem("Dummy Item 13",6);
- Inventory::AddItem("Dummy Item 14",192);
- Inventory::AddItem("Dummy Item 15",35);
- Inventory::AddItem("Dummy Item 16",6);
- Inventory::AddItem("Dummy Item 17",3);
- Inventory::AddItem("Dummy Item 18",1);
- Inventory::AddItem("Dummy Item 19",8);
- Inventory::AddItem("Dummy Item 20",4);
Inventory::AddItem("Bandages",10);
Inventory::AddItem("Blue Slime Remains",22);
- InitializeGraphics();
-
- Menu::InitializeMenus();
-
Monster::InitializeStrategies();
//Animations
sig::Animation::InitializeAnimations();
diff --git a/Crawler/Crawler.vcxproj b/Crawler/Crawler.vcxproj
index c7e6540e..ce25bf43 100644
--- a/Crawler/Crawler.vcxproj
+++ b/Crawler/Crawler.vcxproj
@@ -308,6 +308,7 @@
+
@@ -378,6 +379,7 @@
+
diff --git a/Crawler/Crawler.vcxproj.filters b/Crawler/Crawler.vcxproj.filters
index 3cad7224..c61829dc 100644
--- a/Crawler/Crawler.vcxproj.filters
+++ b/Crawler/Crawler.vcxproj.filters
@@ -55,6 +55,9 @@
{09fc0cbe-06f7-4fdf-944c-9833066bb9c8}
+
+ {bea40439-f3a2-42f8-be1a-c0a815007075}
+
@@ -326,6 +329,9 @@
Source Files\Interface
+
+ Source Files\Interface
+
@@ -397,6 +403,9 @@
Resource Files
+
+ Documentation\Menus
+
diff --git a/Crawler/InventoryWindow.cpp b/Crawler/InventoryWindow.cpp
index 2fcac464..71dcca05 100644
--- a/Crawler/InventoryWindow.cpp
+++ b/Crawler/InventoryWindow.cpp
@@ -1,6 +1,5 @@
#pragma once
#include "Crawler.h"
-#include "DEFINES.h"
#include "olcPixelGameEngine.h"
#include "safemap.h"
#include "Item.h"
@@ -8,39 +7,27 @@
#include "MenuLabel.h"
#include "ScrollableWindowComponent.h"
-INCLUDE_GFX
typedef Attribute A;
void Menu::InitializeInventoryWindow(){
- constexpr int invWidth=5;
- constexpr int initialInvHeight=3;
+ int invWidth="ThemeGlobal.InventoryWidth"_I;
+ int initialInvHeight="ThemeGlobal.InventoryHeight"_I;
- constexpr int itemSpacing=8;
- constexpr int buttonSize=24;
- constexpr int totalSpacing=buttonSize+itemSpacing;
+ int itemSpacing="ThemeGlobal.InventoryItemSpacing"_I;
+ int buttonSize="ThemeGlobal.InventoryButtonSize"_I;
+ int totalSpacing=buttonSize+itemSpacing;
- vf2d windowSize={totalSpacing*invWidth-itemSpacing+2+24,totalSpacing*(3+1)-itemSpacing+24}; //Need space for the button.
+ vf2d windowSize={float(totalSpacing*invWidth-itemSpacing+2+24),float(totalSpacing*(3+1)-itemSpacing+24)}; //Need space for the button.
Menu*inventoryWindow=CreateMenu(INVENTORY,CENTERED,windowSize);
- ScrollableWindowComponent*inventory=new ScrollableWindowComponent(INVENTORY,{{1,0},{windowSize.x,totalSpacing*3-itemSpacing}},nullptr,[](MenuFuncData data){});
+ ScrollableWindowComponent*inventory=new ScrollableWindowComponent(INVENTORY,{{1,0},{windowSize.x,float(totalSpacing*3-itemSpacing)}},nullptr,[](MenuFuncData data){});
inventoryWindow->AddComponent("inventory",inventory);
- MenuFunc useItemFunc=[](MenuFuncData data){
- MenuItemButton*button=(MenuItemButton*)data.component;
- button->UseItem();
- };
+ //We don't have to actually populate the inventory list because now when an item gets added, it will automatically add the correct component in for us.
- for(int i=0;iAddComponent(inventoryWindow,"item"+std::to_string(itemIndex),button);
- }
-
- MenuLabel*itemNameLabel=new MenuLabel{INVENTORY,geom2d::rect(vf2d{2,initialInvHeight*totalSpacing-4},windowSize),"",false,true};
+ MenuLabel*itemNameLabel=new MenuLabel{INVENTORY,geom2d::rect(vf2d{2,float(initialInvHeight*totalSpacing-4)},windowSize),"",false,true};
inventoryWindow->AddComponent("itemName",itemNameLabel);
- MenuLabel*itemDescriptionLabel=new MenuLabel{INVENTORY,geom2d::rect(vf2d{2,initialInvHeight*totalSpacing+itemSpacing},{windowSize.x-4,windowSize.y-108}),"",true,true};
+ MenuLabel*itemDescriptionLabel=new MenuLabel{INVENTORY,geom2d::rect(vf2d{2,float(initialInvHeight*totalSpacing+itemSpacing)},{windowSize.x-4,windowSize.y-108}),"",true,true};
inventoryWindow->AddComponent("itemDescription",itemDescriptionLabel);
}
\ No newline at end of file
diff --git a/Crawler/Item.cpp b/Crawler/Item.cpp
index 5ca66934..b52ebc38 100644
--- a/Crawler/Item.cpp
+++ b/Crawler/Item.cpp
@@ -3,6 +3,7 @@
#include "safemap.h"
#include "DEFINES.h"
#include "Crawler.h"
+#include "Menu.h"
INCLUDE_game
INCLUDE_DATA
@@ -159,6 +160,9 @@ void Inventory::RemoveItem(IT it,uint32_t amt){
}
sortedList.erase(sortedList.begin()+count);
_inventory.erase(it);
+ ITCategory cat=ITEM_DATA[it].category;
+ //Callback for GUI inventories.
+ Menu::InventorySlotsUpdated(cat);
}else{
_inventory.at(it).amt-=amt;
}
@@ -170,6 +174,8 @@ std::vector&Inventory::get(ITCategory itemCategory){
void Inventory::InsertIntoSortedInv(IT item){
sortedInv.at(ITEM_DATA[item].category).push_back(item);
+ //This should be a callback to menus that we need to update the interface with another item slot since a new one has appeared.
+ Menu::InventorySlotsUpdated(ITEM_DATA[item].category);
}
bool Inventory::ExecuteAction(IT item){
diff --git a/Crawler/Menu.cpp b/Crawler/Menu.cpp
index 0e590de6..90bb8d33 100644
--- a/Crawler/Menu.cpp
+++ b/Crawler/Menu.cpp
@@ -2,6 +2,9 @@
#include "MenuComponent.h"
#include "DEFINES.h"
#include "safemap.h"
+#include "Item.h"
+#include "MenuItemButton.h"
+#include "ScrollableWindowComponent.h"
bool Menu::MOUSE_NAVIGATION=true;
std::vector