PopupMenuLabels respect parent menu's position.
This commit is contained in:
parent
195cc31a7b
commit
11e2aa0fad
@ -74,13 +74,13 @@ void Menu::InitializeLevelCompleteWindow(){
|
|||||||
levelCompleteWindow->AddComponent("Next Button",nextButton);
|
levelCompleteWindow->AddComponent("Next Button",nextButton);
|
||||||
|
|
||||||
PopupMenuLabel*monsterLootPopupItemName=NEW PopupMenuLabel(LEVEL_COMPLETE,{{0,108},{windowSize.size.x-80.f,12}},"",1.0f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND);
|
PopupMenuLabel*monsterLootPopupItemName=NEW PopupMenuLabel(LEVEL_COMPLETE,{{0,108},{windowSize.size.x-80.f,12}},"",1.0f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND);
|
||||||
PopupMenuLabel*monsterLootPopupItemDescription=NEW PopupMenuLabel(LEVEL_COMPLETE,{{0,120},{windowSize.size.x-80.f,60}},"",1.0f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::BACKGROUND);
|
PopupMenuLabel*monsterLootPopupItemDescription=NEW PopupMenuLabel(LEVEL_COMPLETE,{{0,120},{windowSize.size.x-80.f,60}},"",1.0f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND);
|
||||||
|
|
||||||
levelCompleteWindow->AddComponent("Monster Loot Popup Item Name",monsterLootPopupItemName);
|
levelCompleteWindow->AddComponent("Monster Loot Popup Item Name",monsterLootPopupItemName);
|
||||||
levelCompleteWindow->AddComponent("Monster Loot Popup Item Description",monsterLootPopupItemDescription);
|
levelCompleteWindow->AddComponent("Monster Loot Popup Item Description",monsterLootPopupItemDescription);
|
||||||
|
|
||||||
PopupMenuLabel*stageLootPopupItemName=NEW PopupMenuLabel(LEVEL_COMPLETE,{{0,32},{windowSize.size.x-80.f,12}},"",1.0f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND);
|
PopupMenuLabel*stageLootPopupItemName=NEW PopupMenuLabel(LEVEL_COMPLETE,{{0,32},{windowSize.size.x-80.f,12}},"",1.0f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND);
|
||||||
PopupMenuLabel*stageLootPopupItemDescription=NEW PopupMenuLabel(LEVEL_COMPLETE,{{0,44},{windowSize.size.x-80.f,72}},"",1.0f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::BACKGROUND);
|
PopupMenuLabel*stageLootPopupItemDescription=NEW PopupMenuLabel(LEVEL_COMPLETE,{{0,44},{windowSize.size.x-80.f,60}},"",1.0f,ComponentAttr::LEFT_ALIGN|ComponentAttr::SHADOW|ComponentAttr::OUTLINE|ComponentAttr::BACKGROUND);
|
||||||
|
|
||||||
levelCompleteWindow->AddComponent("Stage Loot Popup Item Name",stageLootPopupItemName);
|
levelCompleteWindow->AddComponent("Stage Loot Popup Item Name",stageLootPopupItemName);
|
||||||
levelCompleteWindow->AddComponent("Stage Loot Popup Item Description",stageLootPopupItemDescription);
|
levelCompleteWindow->AddComponent("Stage Loot Popup Item Description",stageLootPopupItemDescription);
|
||||||
|
@ -54,25 +54,25 @@ protected:
|
|||||||
virtual void inline DrawDecal(Crawler*game,vf2d parentPos,bool focused)override{
|
virtual void inline DrawDecal(Crawler*game,vf2d parentPos,bool focused)override{
|
||||||
if(label.length()>0){
|
if(label.length()>0){
|
||||||
MenuLabel::DrawDecal(game,parentPos,focused);
|
MenuLabel::DrawDecal(game,parentPos,focused);
|
||||||
std::string wrappedText=util::WrapText(game,label,rect.size.x,true,{scale,scale});
|
std::string wrappedText=util::WrapText(game,label,rect.size.x-1,true,{scale,scale});
|
||||||
vf2d drawPos=parentPos+rect.middle()-vf2d{game->GetTextSizeProp(wrappedText)}*float(scale)/2; //Assume centered.
|
vf2d drawPos=Menu::menus.at(parentMenu)->pos+parentPos+rect.middle()-vf2d{game->GetTextSizeProp(wrappedText)}*float(scale)/2; //Assume centered.
|
||||||
if(!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.
|
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.
|
||||||
}
|
}
|
||||||
|
if(background){
|
||||||
|
game->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));
|
||||||
|
}
|
||||||
|
if(border){
|
||||||
|
game->DrawRectDecal(Menu::menus.at(parentMenu)->pos+rect.pos+parentPos,rect.size);
|
||||||
|
}
|
||||||
|
if(showDefaultLabel){
|
||||||
|
game->DrawStringPropDecal(Menu::menus.at(parentMenu)->pos+rect.pos+parentPos+rect.size/2-game->GetTextSizeProp(label)/2,label);
|
||||||
|
}
|
||||||
if(shadow){
|
if(shadow){
|
||||||
game->DrawShadowStringPropDecal(drawPos,wrappedText,WHITE,BLACK,{scale,scale});
|
game->DrawShadowStringPropDecal(drawPos,wrappedText,WHITE,BLACK,{scale,scale});
|
||||||
}else{
|
}else{
|
||||||
game->DrawStringPropDecal(drawPos,wrappedText,WHITE,{scale,scale});
|
game->DrawStringPropDecal(drawPos,wrappedText,WHITE,{scale,scale});
|
||||||
}
|
}
|
||||||
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->DrawRectDecal(rect.pos+parentPos,rect.size);
|
|
||||||
}
|
|
||||||
if(showDefaultLabel){
|
|
||||||
game->DrawStringPropDecal(rect.pos+parentPos+rect.size/2-game->GetTextSizeProp(label)/2,label);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -35,7 +35,7 @@ SUCH DAMAGE.
|
|||||||
#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 2987
|
#define VERSION_BUILD 2992
|
||||||
|
|
||||||
#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