diff --git a/Crawler/CharacterMenuWindow.cpp b/Crawler/CharacterMenuWindow.cpp index a558750c..b44b5015 100644 --- a/Crawler/CharacterMenuWindow.cpp +++ b/Crawler/CharacterMenuWindow.cpp @@ -53,12 +53,12 @@ INCLUDE_GFX void Menu::InitializeCharacterMenuWindow(){ static bool equipmentWindowOpened=false; - vf2d windowSize=game->GetScreenSize()-vf2d{52,52}; + vf2d windowSize=game->GetScreenSize()-vf2d{52,0}; Menu*characterMenuWindow=CreateMenu(CHARACTER_MENU,CENTERED,windowSize); - characterMenuWindow->ADD("Character Label",MenuLabel)({{0,-4},{float(windowSize.x)-1,24}},"Character",2,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END; - characterMenuWindow->ADD("Equip Slot Outline",MenuComponent)({{0,28},{120,windowSize.y-37}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)END; - characterMenuWindow->ADD("Character Rotating Display",CharacterRotatingDisplay)({{135,28},{90,windowSize.y-37}},GFX[classutils::GetClassInfo(game->GetPlayer()->GetClassName()).classFullImgName].Decal())END; + characterMenuWindow->ADD("Character Label",MenuLabel)({{0,2},{float(windowSize.x)-1,24}},"Character",2,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND)END; + characterMenuWindow->ADD("Equip Slot Outline",MenuComponent)({{0,28},{120,windowSize.y-48}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)END; + characterMenuWindow->ADD("Character Rotating Display",CharacterRotatingDisplay)({{135,28},{90,windowSize.y-48}},GFX[classutils::GetClassInfo(game->GetPlayer()->GetClassName()).classFullImgName].Decal())END; const static std::arraydisplayAttrs{ ItemAttribute::health, @@ -71,13 +71,13 @@ void Menu::InitializeCharacterMenuWindow(){ }; - characterMenuWindow->ADD("Equip Selection Outline",MenuComponent)({{123,28},{120,windowSize.y-37}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)END + characterMenuWindow->ADD("Equip Selection Outline",MenuComponent)({{123,28},{120,windowSize.y-48}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)END ->Enable(false); - characterMenuWindow->ADD("Equip List",ScrollableWindowComponent)({{123,28},{120,windowSize.y-37-24}})DEPTH -1 END + characterMenuWindow->ADD("Equip List",ScrollableWindowComponent)({{123,28},{120,windowSize.y-48-24}})DEPTH -1 END ->Enable(false); - characterMenuWindow->ADD("Equip Selection Bottom Outline",MenuComponent)({{123,28+(windowSize.y-37-24)},{120,24}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)END + characterMenuWindow->ADD("Equip Selection Bottom Outline",MenuComponent)({{123,28+(windowSize.y-48-24)},{120,24}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)END ->Enable(false); - auto equipSelectionSelectButton=characterMenuWindow->ADD("Equip Selection Select Button",MenuComponent)({{123+12,28+(windowSize.y-37-24)+6},{96,12}},"Select", + auto equipSelectionSelectButton=characterMenuWindow->ADD("Equip Selection Select Button",MenuComponent)({{123+12,28+(windowSize.y-48-24)+6},{96,12}},"Select", [](MenuFuncData data){ Component(data.component->parentMenu,"Equip Selection Outline")->Enable(false); Component(data.component->parentMenu,"Equip List")->Enable(false); @@ -218,7 +218,7 @@ void Menu::InitializeCharacterMenuWindow(){ Menu::AddEquipStatListener(equipmentSlot); } - characterMenuWindow->ADD("Stat Display Outline",MenuComponent)({{245,28},{62,windowSize.y-37}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)END; + characterMenuWindow->ADD("Stat Display Outline",MenuComponent)({{245,28},{62,windowSize.y-48}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE)END; int yOffset=0; for(ItemAttribute attribute:displayAttrs){ @@ -229,13 +229,15 @@ void Menu::InitializeCharacterMenuWindow(){ yOffset+=20; } - characterMenuWindow->ADD("Back button",MenuComponent)({{windowSize.x/2-64,windowSize.y},{128,12}},"Back",[](MenuFuncData data){Menu::stack.pop_back();return true;})END; + characterMenuWindow->ADD("Back button",MenuComponent)({{windowSize.x/2-64,windowSize.y-16},{128,12}},"Back",[](MenuFuncData data){Menu::stack.pop_back();return true;})END; auto itemNameDisplay=characterMenuWindow->ADD("Item Name",MenuLabel)({{0,28},{120,12}},"",1,ComponentAttr::BACKGROUND|ComponentAttr::LEFT_ALIGN|ComponentAttr::OUTLINE|ComponentAttr::SHADOW)END; - auto itemDescriptionDisplay=characterMenuWindow->ADD("Item Description",MenuLabel)({{0,40},{120,windowSize.y-49}},"",1,ComponentAttr::BACKGROUND|ComponentAttr::LEFT_ALIGN|ComponentAttr::OUTLINE|ComponentAttr::SHADOW)END; - characterMenuWindow->ADD("Item Equip Name",MenuLabel)({{123,28},{120,12}},"",1,ComponentAttr::BACKGROUND|ComponentAttr::LEFT_ALIGN|ComponentAttr::OUTLINE|ComponentAttr::SHADOW)END; - characterMenuWindow->ADD("Item Equip Description",MenuLabel)({{123,40},{120,windowSize.y-49}},"",1,ComponentAttr::BACKGROUND|ComponentAttr::LEFT_ALIGN|ComponentAttr::OUTLINE|ComponentAttr::SHADOW)END; + auto itemDescriptionDisplay=characterMenuWindow->ADD("Item Description",MenuLabel)({{0,40},{120,windowSize.y-60}},"",1,ComponentAttr::BACKGROUND|ComponentAttr::LEFT_ALIGN|ComponentAttr::OUTLINE|ComponentAttr::SHADOW)END; + auto itemEquipNameDisplay=characterMenuWindow->ADD("Item Equip Name",MenuLabel)({{123,28},{120,12}},"",1,ComponentAttr::BACKGROUND|ComponentAttr::LEFT_ALIGN|ComponentAttr::OUTLINE|ComponentAttr::SHADOW)END; + auto itemEquipDescriptionDisplay=characterMenuWindow->ADD("Item Equip Description",MenuLabel)({{123,40},{120,windowSize.y-60}},"",1,ComponentAttr::BACKGROUND|ComponentAttr::LEFT_ALIGN|ComponentAttr::OUTLINE|ComponentAttr::SHADOW)END; itemNameDisplay->Enable(false); itemDescriptionDisplay->Enable(false); + itemEquipNameDisplay->Enable(false); + itemEquipDescriptionDisplay->Enable(false); } \ No newline at end of file diff --git a/Crawler/EncountersSpawnListScrollableWindowComponent.h b/Crawler/EncountersSpawnListScrollableWindowComponent.h index d8aaf67e..a6c9c72b 100644 --- a/Crawler/EncountersSpawnListScrollableWindowComponent.h +++ b/Crawler/EncountersSpawnListScrollableWindowComponent.h @@ -61,7 +61,6 @@ public: } return false;}); int offsetY=0; - vf2d parentPos=Menu::menus.at(OVERWORLD_LEVEL_SELECT)->pos; vf2d parentSize=Menu::menus.at(OVERWORLD_LEVEL_SELECT)->size; for(int spawn:spawns){ ADD("Spawn "+std::to_string(spawn),SpawnEncounterLabel)({vf2d{0,float(offsetY)},{parentSize.x,12}},MONSTER_DATA.at(spawn-1).GetDisplayName(),spawn-1)END; diff --git a/Crawler/InventoryConsumableWindow.cpp b/Crawler/InventoryConsumableWindow.cpp index 7d3e46d7..60364368 100644 --- a/Crawler/InventoryConsumableWindow.cpp +++ b/Crawler/InventoryConsumableWindow.cpp @@ -49,7 +49,7 @@ void Menu::InitializeConsumableInventoryWindow(){ int itemSpacing=24; int totalSpacing=32; - vf2d windowSize={float(160+16),float(96+64)}; //Need space for the button. + vf2d windowSize={float(160+16),float(96+78)}; //Need space for the button. Menu*inventoryWindow=CreateMenu(INVENTORY_CONSUMABLES,CENTERED,windowSize); diff --git a/Crawler/MenuIconButton.h b/Crawler/MenuIconButton.h index e18a9f33..ce68af06 100644 --- a/Crawler/MenuIconButton.h +++ b/Crawler/MenuIconButton.h @@ -63,7 +63,7 @@ protected: MenuComponent::DrawDecal(window,parentPos,focused); if(icon!=nullptr){ vf2d iconScale=rect.size/24.f; - window.DrawDecal(Menu::menus[parentMenu]->pos+parentPos+rect.middle()-icon->sprite->Size()*iconScale/2,icon,iconScale); + window.DrawDecal(parentPos+rect.middle()-icon->sprite->Size()*iconScale/2,icon,iconScale); } } }; diff --git a/Crawler/MenuItemItemButton.h b/Crawler/MenuItemItemButton.h index 0c7747c1..73670165 100644 --- a/Crawler/MenuItemItemButton.h +++ b/Crawler/MenuItemItemButton.h @@ -137,7 +137,7 @@ protected: std::string quantityText="x"+std::to_string(itemRef.get().Amt()); vf2d quantityTextScale=rect.size/48.f; vf2d textSize=vf2d(game->GetTextSizeProp(quantityText))*quantityTextScale; - vf2d drawPos=Menu::menus[parentMenu]->pos+parentPos+rect.pos+rect.size-textSize; + vf2d drawPos=parentPos+rect.pos+rect.size-textSize; geom2d::rectboundingBox={drawPos,textSize}; window.DrawShadowStringDecal(drawPos,quantityText,WHITE,BLACK,quantityTextScale,quantityTextScale.x); } diff --git a/Crawler/PopupMenuLabel.h b/Crawler/PopupMenuLabel.h index a118bd2c..fab7846c 100644 --- a/Crawler/PopupMenuLabel.h +++ b/Crawler/PopupMenuLabel.h @@ -59,20 +59,19 @@ protected: } virtual void inline DrawDecal(ViewPort&window,vf2d parentPos,bool focused)override{ if(label.length()>0){ - MenuLabel::DrawDecal(window,parentPos,focused); std::string wrappedText=util::WrapText(game,label,int(rect.size.x-1),true,scale); - vf2d drawPos=Menu::menus.at(parentMenu)->pos+parentPos+rect.middle()-vf2d{game->GetTextSizeProp(wrappedText)}*scale/2; //Assume centered. + vf2d drawPos=parentPos+rect.middle()-vf2d{game->GetTextSizeProp(wrappedText)}*scale/2; //Assume centered. if(!centered){ - drawPos=Menu::menus.at(parentMenu)->pos+vf2d{rect.pos.x+2,rect.middle().y-game->GetTextSizeProp(wrappedText).y/2}+parentPos; //We should at least vertically align here. + drawPos=vf2d{rect.pos.x+2,rect.middle().y-game->GetTextSizeProp(wrappedText).y/2}+parentPos; //We should at least vertically align here. } if(background){ - window.FillRectDecal(Menu::menus.at(parentMenu)->pos+rect.pos+parentPos,rect.size,PixelLerp(Menu::themes[Menu::themeSelection].GetButtonCol(),Menu::themes[Menu::themeSelection].GetHighlightCol(),hoverEffect/"ThemeGlobal.HighlightTime"_F)); + window.FillRectDecal(rect.pos+parentPos,rect.size,PixelLerp(Menu::themes[Menu::themeSelection].GetButtonCol(),Menu::themes[Menu::themeSelection].GetHighlightCol(),hoverEffect/"ThemeGlobal.HighlightTime"_F)); } if(border){ - window.DrawRectDecal(Menu::menus.at(parentMenu)->pos+rect.pos+parentPos,rect.size); + window.DrawRectDecal(rect.pos+parentPos,rect.size); } if(showDefaultLabel){ - window.DrawStringPropDecal(Menu::menus.at(parentMenu)->pos+rect.pos+parentPos+rect.size/2-game->GetTextSizeProp(label)/2,label); + window.DrawStringPropDecal(rect.pos+parentPos+rect.size/2-game->GetTextSizeProp(label)/2,label); } if(shadow){ window.DrawShadowStringPropDecal(drawPos,wrappedText,WHITE,BLACK,scale); diff --git a/Crawler/ScrollableWindowComponent.h b/Crawler/ScrollableWindowComponent.h index e8d760d8..f304f473 100644 --- a/Crawler/ScrollableWindowComponent.h +++ b/Crawler/ScrollableWindowComponent.h @@ -63,7 +63,6 @@ public: :MenuComponent(rect,"",[](MenuFuncData data){return true;},ButtonAttr::UNSELECTABLE|ButtonAttr::UNSELECTABLE_VIA_KEYBOARD){ background=attributes&ComponentAttr::BACKGROUND; border=attributes&ComponentAttr::OUTLINE; - subWindow=ViewPort::rectViewPort({},rect.size,rect.pos); } virtual inline void RemoveAllComponents(){ while(components.size()>0){ @@ -99,6 +98,9 @@ protected: //Let's use the internal name of this component to add unique names for sub-components. upButton=Menu::menus[parentMenu]->ADD(name+vf2d(rect.pos+vf2d{rect.size.x-12,0}).str()+"_"+vf2d(12,12).str(),MenuComponent)({rect.pos+vf2d{rect.size.x-12,0},{12,12}},"^",[&](MenuFuncData dat){V(A::SCROLL_OFFSET).y+="ThemeGlobal.MenuButtonScrollSpeed"_I;return true;},ButtonAttr::UNSELECTABLE_VIA_KEYBOARD)DEPTH -1 END; downButton=Menu::menus[parentMenu]->ADD(name+vf2d(rect.pos+rect.size-vf2d{12,12}).str()+"_"+vf2d(12,12).str(),MenuComponent)({rect.pos+rect.size-vf2d{12,12},{12,12}},"v",[&](MenuFuncData dat){V(A::SCROLL_OFFSET).y-="ThemeGlobal.MenuButtonScrollSpeed"_I;return true;},ButtonAttr::UNSELECTABLE_VIA_KEYBOARD)DEPTH -1 END; + subWindow=ViewPort::rectViewPort({},rect.size,Menu::menus[parentMenu]->pos+rect.pos); + if(upButton){upButton->Enable(!disabled);} + if(downButton){downButton->Enable(!disabled);} } virtual inline void BeforeUpdate(Crawler*game)override{ for(MenuComponent*component:components){ @@ -181,12 +183,12 @@ protected: virtual inline void DrawDecal(ViewPort&window,vf2d parentPos,bool focused)override{ MenuComponent::DrawDecal(window,parentPos,focused); if(border){ - game->DrawRectDecal(rect.pos+Menu::menus[parentMenu]->pos,rect.size); + window.DrawRectDecal(rect.pos,rect.size); } for(MenuComponent*component:components){ - component->_DrawDecal(subWindow,rect.pos+Menu::menus[parentMenu]->pos+V(A::SCROLL_OFFSET),focused); + component->_DrawDecal(subWindow,V(A::SCROLL_OFFSET),focused); } - DrawScrollbar(window,Menu::menus[parentMenu]->pos,focused); + DrawScrollbar(window,{},focused); } virtual bool GetHoverState(Crawler*game,MenuComponent*child)override{ return geom2d::overlaps(geom2d::rect{Menu::menus[parentMenu]->pos+rect.pos+child->rect.pos+V(A::SCROLL_OFFSET),child->rect.size},game->GetMousePos()); diff --git a/Crawler/Version.h b/Crawler/Version.h index 0f7a266d..eaf8bded 100644 --- a/Crawler/Version.h +++ b/Crawler/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 1 -#define VERSION_BUILD 3909 +#define VERSION_BUILD 3937 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/x64/Release/Crawler.exe b/x64/Release/Crawler.exe index c40dcc5c..dcbf24b7 100644 Binary files a/x64/Release/Crawler.exe and b/x64/Release/Crawler.exe differ