Back button in character stats window, moved elements slightly upwards for better positioning.
This commit is contained in:
parent
ae2d1719c8
commit
13104bae66
@ -54,10 +54,11 @@ void Menu::InitializeCharacterMenuWindow(){
|
|||||||
vf2d windowSize=game->GetScreenSize()-vf2d{52,52};
|
vf2d windowSize=game->GetScreenSize()-vf2d{52,52};
|
||||||
Menu*characterMenuWindow=CreateMenu(CHARACTER_MENU,CENTERED,windowSize);
|
Menu*characterMenuWindow=CreateMenu(CHARACTER_MENU,CENTERED,windowSize);
|
||||||
|
|
||||||
MenuLabel*characterLabel=NEW MenuLabel(CHARACTER_MENU,{{0,4},{float(windowSize.x)-1,24}},"Character",2,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND);
|
MenuLabel*characterLabel=NEW MenuLabel(CHARACTER_MENU,{{0,-4},{float(windowSize.x)-1,24}},"Character",2,ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND);
|
||||||
|
characterLabel->decal=true;
|
||||||
|
|
||||||
MenuComponent*equipSlotOutline=NEW MenuComponent(CHARACTER_MENU,{{0,36},{120,windowSize.y-37}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE);
|
MenuComponent*equipSlotOutline=NEW MenuComponent(CHARACTER_MENU,{{0,28},{120,windowSize.y-37}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE);
|
||||||
CharacterRotatingDisplay*charDisplay=NEW CharacterRotatingDisplay(CHARACTER_MENU,{{135,36},{90,windowSize.y-37}},GFX[classutils::GetClassInfo(game->GetPlayer()->GetClassName()).classFullImgName].Decal());
|
CharacterRotatingDisplay*charDisplay=NEW CharacterRotatingDisplay(CHARACTER_MENU,{{135,28},{90,windowSize.y-37}},GFX[classutils::GetClassInfo(game->GetPlayer()->GetClassName()).classFullImgName].Decal());
|
||||||
|
|
||||||
characterMenuWindow->AddComponent("Character Label",characterLabel);
|
characterMenuWindow->AddComponent("Character Label",characterLabel);
|
||||||
characterMenuWindow->AddComponent("Equip Slot Outline",equipSlotOutline);
|
characterMenuWindow->AddComponent("Equip Slot Outline",equipSlotOutline);
|
||||||
@ -73,10 +74,10 @@ void Menu::InitializeCharacterMenuWindow(){
|
|||||||
ItemAttribute::critDmgPct,
|
ItemAttribute::critDmgPct,
|
||||||
};
|
};
|
||||||
|
|
||||||
MenuComponent*equipSelectionOutline=NEW MenuComponent(CHARACTER_MENU,{{123,36},{120,windowSize.y-37}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE);
|
MenuComponent*equipSelectionOutline=NEW MenuComponent(CHARACTER_MENU,{{123,28},{120,windowSize.y-37}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE);
|
||||||
ScrollableWindowComponent*equipmentList=NEW ScrollableWindowComponent(CHARACTER_MENU,{{123,36},{120,windowSize.y-37-24}});
|
ScrollableWindowComponent*equipmentList=NEW ScrollableWindowComponent(CHARACTER_MENU,{{123,28},{120,windowSize.y-37-24}});
|
||||||
MenuComponent*equipSelectionBottomOutline=NEW MenuComponent(CHARACTER_MENU,{{123,36+(windowSize.y-37-24)},{120,24}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE);
|
MenuComponent*equipSelectionBottomOutline=NEW MenuComponent(CHARACTER_MENU,{{123,28+(windowSize.y-37-24)},{120,24}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE);
|
||||||
MenuComponent*equipSelectionSelectButton=NEW MenuComponent(CHARACTER_MENU,{{123+12,36+(windowSize.y-37-24)+6},{96,12}},"Select",[](MenuFuncData data){
|
MenuComponent*equipSelectionSelectButton=NEW MenuComponent(CHARACTER_MENU,{{123+12,28+(windowSize.y-37-24)+6},{96,12}},"Select",[](MenuFuncData data){
|
||||||
Component<MenuComponent>(data.component->parentMenu,"Equip Selection Outline")->Enable(false);
|
Component<MenuComponent>(data.component->parentMenu,"Equip Selection Outline")->Enable(false);
|
||||||
Component<ScrollableWindowComponent>(data.component->parentMenu,"Equip List")->Enable(false);
|
Component<ScrollableWindowComponent>(data.component->parentMenu,"Equip List")->Enable(false);
|
||||||
Component<MenuComponent>(data.component->parentMenu,"Equip Selection Bottom Outline")->Enable(false);
|
Component<MenuComponent>(data.component->parentMenu,"Equip Selection Bottom Outline")->Enable(false);
|
||||||
@ -122,7 +123,7 @@ void Menu::InitializeCharacterMenuWindow(){
|
|||||||
const static std::array<std::string,8>slotNames{"Helmet","Weapon","Armor","Gloves","Pants","Shoes","Ring 1","Ring 2"};
|
const static std::array<std::string,8>slotNames{"Helmet","Weapon","Armor","Gloves","Pants","Shoes","Ring 1","Ring 2"};
|
||||||
EquipSlot slot=EquipSlot(equipSlot);
|
EquipSlot slot=EquipSlot(equipSlot);
|
||||||
|
|
||||||
EquipSlotButton*equipmentSlot=NEW EquipSlotButton(CHARACTER_MENU,{{x,y+36},{24,24}},slot,MenuType::ENUM_END,
|
EquipSlotButton*equipmentSlot=NEW EquipSlotButton(CHARACTER_MENU,{{x,y+28},{24,24}},slot,MenuType::ENUM_END,
|
||||||
[&](MenuFuncData data){
|
[&](MenuFuncData data){
|
||||||
EquipSlot slot=EquipSlot(data.component->I(Attribute::EQUIP_TYPE));
|
EquipSlot slot=EquipSlot(data.component->I(Attribute::EQUIP_TYPE));
|
||||||
|
|
||||||
@ -200,7 +201,7 @@ void Menu::InitializeCharacterMenuWindow(){
|
|||||||
Component<CharacterRotatingDisplay>(data.component->parentMenu,"Character Rotating Display")->Enable(false);
|
Component<CharacterRotatingDisplay>(data.component->parentMenu,"Character Rotating Display")->Enable(false);
|
||||||
return true;
|
return true;
|
||||||
},DO_NOTHING,DO_NOTHING);
|
},DO_NOTHING,DO_NOTHING);
|
||||||
PopupMenuLabel*equipmentLabel=NEW PopupMenuLabel(CHARACTER_MENU,{{labelX,labelY},{29,24}},slotNames[i],{0.5,1},ComponentAttr::SHADOW);
|
PopupMenuLabel*equipmentLabel=NEW PopupMenuLabel(CHARACTER_MENU,{{labelX,labelY},{29,16}},slotNames[i],{0.5,1},ComponentAttr::SHADOW);
|
||||||
equipmentSlot->I(Attribute::EQUIP_TYPE)=int(slot);
|
equipmentSlot->I(Attribute::EQUIP_TYPE)=int(slot);
|
||||||
equipmentSlot->I(Attribute::INDEXED_THEME)=i;
|
equipmentSlot->I(Attribute::INDEXED_THEME)=i;
|
||||||
equipmentSlot->SetShowQuantity(false);
|
equipmentSlot->SetShowQuantity(false);
|
||||||
@ -210,17 +211,21 @@ void Menu::InitializeCharacterMenuWindow(){
|
|||||||
Menu::AddEquipStatListener(equipmentSlot);
|
Menu::AddEquipStatListener(equipmentSlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
MenuComponent*statDisplayOutline=NEW MenuComponent(CHARACTER_MENU,{{245,36},{62,windowSize.y-37}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE);
|
MenuComponent*statDisplayOutline=NEW MenuComponent(CHARACTER_MENU,{{245,28},{62,windowSize.y-37}},"",DO_NOTHING,ButtonAttr::UNSELECTABLE);
|
||||||
|
|
||||||
characterMenuWindow->AddComponent("Stat Display Outline",statDisplayOutline);
|
characterMenuWindow->AddComponent("Stat Display Outline",statDisplayOutline);
|
||||||
|
|
||||||
int yOffset=0;
|
int yOffset=0;
|
||||||
for(ItemAttribute attribute:displayAttrs){
|
for(ItemAttribute attribute:displayAttrs){
|
||||||
std::string attrStr=GetLabelText(attribute);
|
std::string attrStr=GetLabelText(attribute);
|
||||||
StatLabel*attrLabel=NEW StatLabel(CHARACTER_MENU,{{245,36+2+float(yOffset)},{62,18}},attribute,1,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN);
|
StatLabel*attrLabel=NEW StatLabel(CHARACTER_MENU,{{245,28+2+float(yOffset)},{62,18}},attribute,1,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN);
|
||||||
yOffset+=20;
|
yOffset+=20;
|
||||||
AttributeData data=ItemAttributable::GetDisplayInfo(attribute);
|
AttributeData data=ItemAttributable::GetDisplayInfo(attribute);
|
||||||
characterMenuWindow->AddComponent("Attribute "+data.name+" Label",attrLabel);
|
characterMenuWindow->AddComponent("Attribute "+data.name+" Label",attrLabel);
|
||||||
Menu::AddEquipStatListener(attrLabel);
|
Menu::AddEquipStatListener(attrLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MenuComponent*backButton=NEW MenuComponent(CHARACTER_MENU,{{windowSize.x/2-64,windowSize.y},{128,12}},"Back",[](MenuFuncData data){Menu::stack.pop_back();return true;});
|
||||||
|
backButton->decal=true;
|
||||||
|
characterMenuWindow->AddComponent("Back button",backButton);
|
||||||
}
|
}
|
||||||
@ -343,6 +343,13 @@ void Menu::Draw(Crawler*game){
|
|||||||
}
|
}
|
||||||
game->SetPixelMode(prevMode);
|
game->SetPixelMode(prevMode);
|
||||||
game->SetDrawTarget(nullptr);
|
game->SetDrawTarget(nullptr);
|
||||||
|
|
||||||
|
if(GetCurrentTheme().IsScaled()){
|
||||||
|
DrawScaledWindowBorder(game,pos,size,GetRenderColor());
|
||||||
|
}else{
|
||||||
|
DrawTiledWindowBorder(game,pos,size,GetRenderColor());
|
||||||
|
}
|
||||||
|
|
||||||
r.Decal()->Update();
|
r.Decal()->Update();
|
||||||
game->DrawDecal(pos,r.Decal());
|
game->DrawDecal(pos,r.Decal());
|
||||||
for(auto&component:displayComponents){
|
for(auto&component:displayComponents){
|
||||||
@ -358,12 +365,6 @@ void Menu::Draw(Crawler*game){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(GetCurrentTheme().IsScaled()){
|
|
||||||
DrawScaledWindowBorder(game,pos,size,GetRenderColor());
|
|
||||||
}else{
|
|
||||||
DrawTiledWindowBorder(game,pos,size,GetRenderColor());
|
|
||||||
}
|
|
||||||
|
|
||||||
if(draggingComponent!=nullptr){
|
if(draggingComponent!=nullptr){
|
||||||
game->SetDrawTarget(overlay.Sprite());
|
game->SetDrawTarget(overlay.Sprite());
|
||||||
Pixel::Mode prevMode=game->GetPixelMode();
|
Pixel::Mode prevMode=game->GetPixelMode();
|
||||||
|
|||||||
@ -84,14 +84,16 @@ void MenuComponent::_Update(Crawler*game){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MenuComponent::Draw(Crawler*game,vf2d parentPos){
|
void MenuComponent::Draw(Crawler*game,vf2d parentPos){
|
||||||
if(background){
|
if(!decal){
|
||||||
game->FillRect(rect.pos+parentPos,rect.size,PixelLerp(Menu::themes[Menu::themeSelection].GetButtonCol(),Menu::themes[Menu::themeSelection].GetHighlightCol(),hoverEffect/"ThemeGlobal.HighlightTime"_F));
|
if(background){
|
||||||
}
|
game->FillRect(rect.pos+parentPos,rect.size,PixelLerp(Menu::themes[Menu::themeSelection].GetButtonCol(),Menu::themes[Menu::themeSelection].GetHighlightCol(),hoverEffect/"ThemeGlobal.HighlightTime"_F));
|
||||||
if(border){
|
}
|
||||||
game->DrawRect(rect.pos+parentPos,rect.size);
|
if(border){
|
||||||
}
|
game->DrawRect(rect.pos+parentPos,rect.size);
|
||||||
if(showDefaultLabel){
|
}
|
||||||
game->DrawStringProp(rect.pos+parentPos+rect.size/2-game->GetTextSizeProp(label)/2,label);
|
if(showDefaultLabel){
|
||||||
|
game->DrawStringProp(rect.pos+parentPos+rect.size/2-game->GetTextSizeProp(label)/2,label);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,7 +109,23 @@ void MenuComponent::_Draw(Crawler*game,vf2d parentPos){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuComponent::DrawDecal(Crawler*game,vf2d parentPos,bool focused){}
|
void MenuComponent::DrawDecal(Crawler*game,vf2d parentPos,bool focused){
|
||||||
|
if(decal){
|
||||||
|
parentPos+=Menu::menus[parentMenu]->pos;
|
||||||
|
if(background){
|
||||||
|
game->FillRectDecal(rect.pos+parentPos,rect.size,PixelLerp(Menu::themes[Menu::themeSelection].GetButtonCol(),Menu::themes[Menu::themeSelection].GetHighlightCol(),hoverEffect/"ThemeGlobal.HighlightTime"_F));
|
||||||
|
}
|
||||||
|
if(border){
|
||||||
|
game->FillRectDecal(rect.pos+parentPos,{rect.size.x,1});
|
||||||
|
game->FillRectDecal(rect.pos+parentPos,{1,rect.size.y});
|
||||||
|
game->FillRectDecal(rect.pos+parentPos+vf2d{rect.size.x-1,0},{1,rect.size.y});
|
||||||
|
game->FillRectDecal(rect.pos+parentPos+vf2d{0,rect.size.y-1},{rect.size.x,1});
|
||||||
|
}
|
||||||
|
if(showDefaultLabel){
|
||||||
|
game->DrawStringPropDecal(rect.pos+parentPos+rect.size/2-game->GetTextSizeProp(label)/2,label);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MenuComponent::_DrawDecal(Crawler*game,bool focused){
|
void MenuComponent::_DrawDecal(Crawler*game,bool focused){
|
||||||
_DrawDecal(game,{0,0},focused);
|
_DrawDecal(game,{0,0},focused);
|
||||||
|
|||||||
@ -85,6 +85,7 @@ protected:
|
|||||||
bool disabled=false; //If set to true, this component will not be rendered or updated.
|
bool disabled=false; //If set to true, this component will not be rendered or updated.
|
||||||
bool renderInMain=true; //If set to false, this component is the responsibility of some other windowing system and won't be rendered or updated via the main window loop.
|
bool renderInMain=true; //If set to false, this component is the responsibility of some other windowing system and won't be rendered or updated via the main window loop.
|
||||||
bool valid=true; //If set to false, this would cause the component to be removed.
|
bool valid=true; //If set to false, this would cause the component to be removed.
|
||||||
|
bool decal=false; //If set to true, will use decal rendering (For foreground shenanigans)
|
||||||
virtual void Update(Crawler*game);
|
virtual void Update(Crawler*game);
|
||||||
virtual void Draw(Crawler*game,vf2d parentPos);
|
virtual void Draw(Crawler*game,vf2d parentPos);
|
||||||
virtual void DrawDecal(Crawler*game,vf2d parentPos,bool focused);
|
virtual void DrawDecal(Crawler*game,vf2d parentPos,bool focused);
|
||||||
|
|||||||
@ -76,4 +76,20 @@ protected:
|
|||||||
game->DrawStringProp(drawPos,wrappedText,WHITE,scale);
|
game->DrawStringProp(drawPos,wrappedText,WHITE,scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
virtual void inline DrawDecal(Crawler*game,vf2d parentPos,bool focused)override{
|
||||||
|
if(decal){
|
||||||
|
MenuComponent::DrawDecal(game,parentPos,focused);
|
||||||
|
parentPos+=Menu::menus[parentMenu]->pos;
|
||||||
|
std::string wrappedText=util::WrapText(game,label,int(rect.size.x),true,{float(scale),float(scale)});
|
||||||
|
vf2d drawPos=parentPos+rect.middle()-vf2d{game->GetTextSizeProp(wrappedText)}*float(scale)/2; //Assume centered.
|
||||||
|
if(!centered){
|
||||||
|
drawPos=vf2d{rect.pos.x+2,rect.middle().y-game->GetTextSizeProp(wrappedText).y/2}+parentPos; //We should at least vertically align here.
|
||||||
|
}
|
||||||
|
if(shadow){
|
||||||
|
game->DrawShadowStringPropDecal(drawPos,wrappedText,WHITE,BLACK,{float(scale),float(scale)});
|
||||||
|
}else{
|
||||||
|
game->DrawStringPropDecal(drawPos,wrappedText,WHITE,{float(scale),float(scale)});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 0
|
#define VERSION_MAJOR 0
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 1
|
#define VERSION_PATCH 1
|
||||||
#define VERSION_BUILD 3598
|
#define VERSION_BUILD 3614
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user