diff --git a/Crawler/CharacterInfoWindow.cpp b/Crawler/CharacterInfoWindow.cpp
index 3d7aa3df..dd0efdc9 100644
--- a/Crawler/CharacterInfoWindow.cpp
+++ b/Crawler/CharacterInfoWindow.cpp
@@ -2,11 +2,15 @@
#include "Crawler.h"
#include "DEFINES.h"
#include "Menu.h"
+#include "MenuLabel.h"
INCLUDE_game
typedef Attribute A;
-void Menu::InitializeCharacterInfoWindow(){
- Menu*characterInfoWindow=CreateMenu(INVENTORY,CENTERED,game->GetScreenSize()-vi2d{4,4});
+void Menu::InitializeClassInfoWindow(){
+ Menu*classInfoWindow=CreateMenu(CLASS_INFO,CENTERED,game->GetScreenSize()-vi2d{64,64});
+ MenuLabel*label=new MenuLabel(CLASS_INFO,{{classInfoWindow->pos.x,classInfoWindow->pos.y+8},{classInfoWindow->size.x,16}},"Warrior",2,true,true);
+
+ classInfoWindow->AddComponent("Class Name",label);
}
\ No newline at end of file
diff --git a/Crawler/ClassSelectionWindow.cpp b/Crawler/ClassSelectionWindow.cpp
new file mode 100644
index 00000000..d728b030
--- /dev/null
+++ b/Crawler/ClassSelectionWindow.cpp
@@ -0,0 +1,12 @@
+#pragma once
+#include "Crawler.h"
+#include "DEFINES.h"
+#include "Menu.h"
+#include "MenuLabel.h"
+
+INCLUDE_game
+typedef Attribute A;
+
+void Menu::InitializeClassSelectionWindow(){
+ Menu*classSelectionWindow=CreateMenu(CLASS_SELECTION,CENTERED,game->GetScreenSize()-vi2d{4,4});
+}
\ No newline at end of file
diff --git a/Crawler/Crawler.vcxproj b/Crawler/Crawler.vcxproj
index 287a0a9e..73cfed00 100644
--- a/Crawler/Crawler.vcxproj
+++ b/Crawler/Crawler.vcxproj
@@ -311,6 +311,7 @@
+
@@ -324,6 +325,7 @@
+
diff --git a/Crawler/Crawler.vcxproj.filters b/Crawler/Crawler.vcxproj.filters
index 8a4137f5..544946ba 100644
--- a/Crawler/Crawler.vcxproj.filters
+++ b/Crawler/Crawler.vcxproj.filters
@@ -335,6 +335,12 @@
Source Files\Interface
+
+ Source Files\Interface
+
+
+ Source Files\Interface
+
diff --git a/Crawler/GameState.cpp b/Crawler/GameState.cpp
index 4c775df6..2be5b39d 100644
--- a/Crawler/GameState.cpp
+++ b/Crawler/GameState.cpp
@@ -6,5 +6,5 @@ void GameState::Initialize(){
NEW_STATE(States::GAME_RUN,State_GameRun);
NEW_STATE(States::MAIN_MENU,State_MainMenu);
- GameState::ChangeState(States::GAME_RUN);
+ GameState::ChangeState(States::MAIN_MENU);
}
\ No newline at end of file
diff --git a/Crawler/InventoryWindow.cpp b/Crawler/InventoryWindow.cpp
index 4113765b..afa92aa5 100644
--- a/Crawler/InventoryWindow.cpp
+++ b/Crawler/InventoryWindow.cpp
@@ -30,8 +30,8 @@ void Menu::InitializeInventoryWindow(){
//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.
- MenuLabel*itemNameLabel=new MenuLabel{INVENTORY,geom2d::rect(vf2d{2,float(initialInvHeight*totalSpacing-4)},windowSize),"",false,true};
+ MenuLabel*itemNameLabel=new MenuLabel{INVENTORY,geom2d::rect(vf2d{2,float(initialInvHeight*totalSpacing-4)},windowSize),"",1,false,true};
inventoryWindow->AddComponent("itemName",itemNameLabel);
- MenuLabel*itemDescriptionLabel=new MenuLabel{INVENTORY,geom2d::rect(vf2d{2,float(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}),"",1,true,true};
inventoryWindow->AddComponent("itemDescription",itemDescriptionLabel);
}
\ No newline at end of file
diff --git a/Crawler/MainMenuWindow.cpp b/Crawler/MainMenuWindow.cpp
new file mode 100644
index 00000000..29b6b9df
--- /dev/null
+++ b/Crawler/MainMenuWindow.cpp
@@ -0,0 +1,12 @@
+#pragma once
+#include "Crawler.h"
+#include "DEFINES.h"
+#include "Menu.h"
+#include "MenuLabel.h"
+
+INCLUDE_game
+typedef Attribute A;
+
+void Menu::InitializeMainMenuWindow(){
+ Menu*mainMenuWindow=CreateMenu(MAIN_MENU,CENTERED,game->GetScreenSize()-vi2d{4,4});
+}
\ No newline at end of file
diff --git a/Crawler/Menu.cpp b/Crawler/Menu.cpp
index eeb21249..81db78a6 100644
--- a/Crawler/Menu.cpp
+++ b/Crawler/Menu.cpp
@@ -30,6 +30,9 @@ void Menu::InitializeMenus(){
InitializeTestMenu();
InitializeTestSubMenu();
InitializeInventoryWindow();
+ InitializeClassInfoWindow();
+ InitializeClassSelectionWindow();
+ InitializeMainMenuWindow();
for(MenuType type=TEST;typeClear(BLANK);
for(auto&component:displayComponents){
if(component->renderInMain){
- component->_Draw(game,{0,0},this==Menu::stack.back());
+ component->_Draw(game,pos,this==Menu::stack.back());
}
}
for(auto&key:buttons){
for(auto&button:key.second){
if(button->renderInMain){
- button->_Draw(game,{0,0},this==Menu::stack.back());
+ button->_Draw(game,pos,this==Menu::stack.back());
}
}
}
@@ -582,4 +585,8 @@ void Menu::AddInventoryListener(MenuComponent*component,ITCategory category){
std::cout<<"WARNING! Inventory category "<inventoryIndex&&ITEM_DATA.count(invRef[inventoryIndex]);
- Menu*menu=Menu::stack.back();
- if(valid){
- icon=ITEM_DATA.at(invRef[inventoryIndex]).Decal();
- if(hovered){
- switch(parentMenu){
- case INVENTORY:{
- //There should be an itemName label to modify.
- menu->components.at("itemName")->label=ITEM_DATA.at(invRef[inventoryIndex]).Name();
- //There should be an itemDescription label to modify.
- menu->components.at("itemDescription")->label=ITEM_DATA.at(invRef[inventoryIndex]).Description();
- }break;
+ if(Menu::stack.size()>0){
+ Menu*menu=Menu::stack.back();
+ if(valid){
+ icon=ITEM_DATA.at(invRef[inventoryIndex]).Decal();
+ if(hovered){
+ switch(parentMenu){
+ case INVENTORY:{
+ //There should be an itemName label to modify.
+ menu->components.at("itemName")->label=ITEM_DATA.at(invRef[inventoryIndex]).Name();
+ //There should be an itemDescription label to modify.
+ menu->components.at("itemDescription")->label=ITEM_DATA.at(invRef[inventoryIndex]).Description();
+ }break;
+ }
}
- }
- }else{
- icon=nullptr;
- if(hovered){
- switch(parentMenu){
- case INVENTORY:{
- //There should be an itemName label to modify.
- menu->components.at("itemName")->label="";
- //There should be an itemDescription label to modify.
- menu->components.at("itemDescription")->label="";
- }break;
+ }else{
+ icon=nullptr;
+ if(hovered){
+ switch(parentMenu){
+ case INVENTORY:{
+ //There should be an itemName label to modify.
+ menu->components.at("itemName")->label="";
+ //There should be an itemDescription label to modify.
+ menu->components.at("itemDescription")->label="";
+ }break;
+ }
}
}
}
diff --git a/Crawler/MenuLabel.h b/Crawler/MenuLabel.h
index d2251b00..655cc80f 100644
--- a/Crawler/MenuLabel.h
+++ b/Crawler/MenuLabel.h
@@ -9,9 +9,10 @@ INCLUDE_game
class MenuLabel:public MenuComponent{
bool shadow=false;
bool centered=true;
+ int scale=1;
public:
- inline MenuLabel(MenuType parent,geom2d::rectrect,std::string label,bool centered=true,bool shadow=false)
- :MenuComponent(parent,rect,label,MenuFunc{},false),centered(centered),shadow(shadow){
+ inline MenuLabel(MenuType parent,geom2d::rectrect,std::string label,int scale=1,bool centered=true,bool shadow=false)
+ :MenuComponent(parent,rect,label,MenuFunc{},false),scale(scale),centered(centered),shadow(shadow){
border=false;
}
inline void SetLabel(std::string text){
@@ -22,15 +23,15 @@ protected:
MenuComponent::Update(game);
}
virtual void inline Draw(Crawler*game,vf2d parentPos,bool focused)override{
- std::string wrappedText=util::WrapText(game,label,rect.size.x,true,{1,1});
- vf2d drawPos=parentPos+rect.middle()-game->GetTextSizeProp(wrappedText)/2; //Assume centered.
+ std::string wrappedText=util::WrapText(game,label,rect.size.x,true,{float(scale),float(scale)});
+ vf2d drawPos=-parentPos+rect.middle()-game->GetTextSizeProp(wrappedText)*float(scale)/2; //Assume centered.
if(!centered){
drawPos=rect.pos+parentPos;
}
if(shadow){
- game->DrawShadowStringProp(drawPos,wrappedText,focused?WHITE:WHITE*"ThemeGlobal.MenuUnfocusedColorMult"_F);
+ game->DrawShadowStringProp(drawPos,wrappedText,focused?WHITE:WHITE*"ThemeGlobal.MenuUnfocusedColorMult"_F,BLACK,{float(scale),float(scale)});
}else{
- game->DrawStringProp(drawPos,wrappedText,focused?WHITE:WHITE*"ThemeGlobal.MenuUnfocusedColorMult"_F);
+ game->DrawStringProp(drawPos,wrappedText,focused?WHITE:WHITE*"ThemeGlobal.MenuUnfocusedColorMult"_F,scale);
}
}
};
\ No newline at end of file
diff --git a/Crawler/State_GameRun.cpp b/Crawler/State_GameRun.cpp
index 9502e6c5..da4f253f 100644
--- a/Crawler/State_GameRun.cpp
+++ b/Crawler/State_GameRun.cpp
@@ -15,26 +15,8 @@ void State_GameRun::OnUserUpdate(Crawler*game){
game->encounterDuration+=game->GetElapsedTime();
}
-
- if(game->GetKey(O).bPressed){
- 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);
- }
- if(game->GetKey(P).bPressed){
- Inventory::AddItem("Medium Mana Potion",1);
- }
-
game->HandleUserInput(game->GetElapsedTime());
- if(game->GetKey(T).bPressed){
- GameState::ChangeState(States::MAIN_MENU);
- }
-
game->UpdateEffects(game->GetElapsedTime());
game->GetPlayer()->Update(game->GetElapsedTime());
for(Monster&m:MONSTER_LIST){
diff --git a/Crawler/State_MainMenu.cpp b/Crawler/State_MainMenu.cpp
index cf6664e4..d87fa0cb 100644
--- a/Crawler/State_MainMenu.cpp
+++ b/Crawler/State_MainMenu.cpp
@@ -3,14 +3,11 @@
#include "Menu.h"
void State_MainMenu::OnStateChange(GameState*prevState){
- Menu::OpenMenu(MenuType::TEST);
+ Menu::OpenMenu(MenuType::CLASS_INFO);
};
void State_MainMenu::OnUserUpdate(Crawler*game){
-
- if(game->GetKey(T).bPressed){
- GameState::ChangeState(States::GAME_RUN);
- }
+
};
void State_MainMenu::Draw(Crawler*game){
- game->DrawShadowStringDecal({0,0},"This will eventually be\nMain Menu stuff",BLACK,WHITE,{1,1},1);
+
};
\ No newline at end of file
diff --git a/Crawler/Version.h b/Crawler/Version.h
index 89f98017..c6c9a709 100644
--- a/Crawler/Version.h
+++ b/Crawler/Version.h
@@ -2,7 +2,7 @@
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 0
-#define VERSION_BUILD 2167
+#define VERSION_BUILD 2184
#define stringify(a) stringify_(a)
#define stringify_(a) #a