Money displays in inventory windows use smaller shadow text outlines. Release Build 10793.
This commit is contained in:
parent
d49e7ff6bb
commit
333acfe149
@ -212,7 +212,7 @@ void Menu::InitializeBlacksmithCraftingWindow(){
|
||||
auto moneyIcon=blacksmithWindow->ADD("Money Icon",MenuIconButton)(geom2d::rect<float>{moneyIconPos,{24,24}},GFX["money.png"].Decal(),DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE|IconButtonAttr::NO_BACKGROUND)END;
|
||||
std::string moneyText=std::to_string(game->GetPlayer()->GetMoney());
|
||||
vf2d moneyTextSize=game->GetTextSizeProp(moneyText)*2;
|
||||
auto moneyDisplay=blacksmithWindow->ADD("Money Label",PlayerMoneyLabel)(geom2d::rect<float>{moneyIconPos-vf2d{2+moneyTextSize.x,-2},moneyTextSize},2,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN|ComponentAttr::FIT_TO_LABEL)END;
|
||||
auto moneyDisplay=blacksmithWindow->ADD("Money Label",PlayerMoneyLabel)(geom2d::rect<float>{moneyIconPos-vf2d{2+moneyTextSize.x,-2},moneyTextSize},2,1.85f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN|ComponentAttr::FIT_TO_LABEL)END;
|
||||
moneyDisplay->SetRightAlignment(true);
|
||||
Player::AddMoneyListener(moneyDisplay);
|
||||
#pragma endregion
|
||||
|
||||
@ -133,7 +133,7 @@ void Menu::InitializeConsumableCraftingWindow(){
|
||||
auto moneyIcon=consumableCraftingWindow->ADD("Money Icon",MenuIconButton)(geom2d::rect<float>{moneyIconPos,{24,24}},GFX["money.png"].Decal(),DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE|IconButtonAttr::NO_BACKGROUND)END;
|
||||
std::string moneyText=std::to_string(game->GetPlayer()->GetMoney());
|
||||
vf2d moneyTextSize=game->GetTextSizeProp(moneyText)*2;
|
||||
auto moneyDisplay=consumableCraftingWindow->ADD("Money Label",PlayerMoneyLabel)(geom2d::rect<float>{moneyIconPos-vf2d{2+moneyTextSize.x,-2},moneyTextSize},2,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN|ComponentAttr::FIT_TO_LABEL)END;
|
||||
auto moneyDisplay=consumableCraftingWindow->ADD("Money Label",PlayerMoneyLabel)(geom2d::rect<float>{moneyIconPos-vf2d{2+moneyTextSize.x,-2},moneyTextSize},2,1.85f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN|ComponentAttr::FIT_TO_LABEL)END;
|
||||
moneyDisplay->SetRightAlignment(true);
|
||||
Player::AddMoneyListener(moneyDisplay);
|
||||
#pragma endregion
|
||||
|
||||
@ -150,7 +150,7 @@ void Menu::InitializeInventoryWindow(){
|
||||
auto moneyIcon=inventoryWindow->ADD("Money Icon",MenuIconButton)(geom2d::rect<float>{moneyIconPos,{24,24}},GFX["money.png"].Decal(),DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE|IconButtonAttr::NO_BACKGROUND)END;
|
||||
std::string moneyText=std::to_string(game->GetPlayer()->GetMoney());
|
||||
vf2d moneyTextSize=game->GetTextSizeProp(moneyText)*2;
|
||||
auto moneyDisplay=inventoryWindow->ADD("Money Label",PlayerMoneyLabel)(geom2d::rect<float>{moneyIconPos-vf2d{2+moneyTextSize.x,-2},moneyTextSize},2,SHADOW|LEFT_ALIGN|FIT_TO_LABEL)END;
|
||||
auto moneyDisplay=inventoryWindow->ADD("Money Label",PlayerMoneyLabel)(geom2d::rect<float>{moneyIconPos-vf2d{2+moneyTextSize.x,-2},moneyTextSize},2,1.85f,SHADOW|LEFT_ALIGN|FIT_TO_LABEL)END;
|
||||
moneyDisplay->SetRightAlignment(true);
|
||||
Player::AddMoneyListener(moneyDisplay);
|
||||
#pragma endregion
|
||||
|
||||
@ -48,6 +48,7 @@ INCLUDE_game
|
||||
class MenuLabel:public MenuComponent{
|
||||
protected:
|
||||
float scale=1;
|
||||
float shadowScale=1;
|
||||
bool shadow=false;
|
||||
bool centered=true;
|
||||
bool multiLineCentered=false;
|
||||
@ -68,7 +69,7 @@ public:
|
||||
this->onLabelChangeFunc=onLabelChangeFunc;
|
||||
}
|
||||
inline MenuLabel(geom2d::rect<float>rect,std::string label,float scale=1,ComponentAttr attributes=ComponentAttr::NONE)
|
||||
:MenuComponent(rect,label,MenuFunc{},ButtonAttr::UNSELECTABLE|ButtonAttr::UNSELECTABLE_VIA_KEYBOARD),scale(scale),rightAlign(attributes&ComponentAttr::RIGHT_ALIGN),centered(!(attributes&ComponentAttr::LEFT_ALIGN)&&!(attributes&ComponentAttr::RIGHT_ALIGN)),shadow(attributes&ComponentAttr::SHADOW),proportional(!(attributes&ComponentAttr::FIXED_WIDTH_FONT)),multiLineCentered(attributes&ComponentAttr::CENTER){
|
||||
:MenuComponent(rect,label,MenuFunc{},ButtonAttr::UNSELECTABLE|ButtonAttr::UNSELECTABLE_VIA_KEYBOARD),scale(scale),shadowScale(scale),rightAlign(attributes&ComponentAttr::RIGHT_ALIGN),centered(!(attributes&ComponentAttr::LEFT_ALIGN)&&!(attributes&ComponentAttr::RIGHT_ALIGN)),shadow(attributes&ComponentAttr::SHADOW),proportional(!(attributes&ComponentAttr::FIXED_WIDTH_FONT)),multiLineCentered(attributes&ComponentAttr::CENTER){
|
||||
border=attributes&ComponentAttr::OUTLINE;
|
||||
this->background=attributes&ComponentAttr::BACKGROUND;
|
||||
showDefaultLabel=false;
|
||||
@ -90,6 +91,7 @@ protected:
|
||||
censoredTextEntry=std::accumulate(GetLabel().begin(),GetLabel().end(),""s,[](std::string currentStr,const char&c){return std::move(currentStr)+'*';});
|
||||
std::string_view finalLabel=censored?censoredTextEntry:GetLabel();
|
||||
vf2d adjustedScale={scale,scale};
|
||||
vf2d adjustedShadowScale={shadowScale,shadowScale};
|
||||
vf2d labelTextSize=
|
||||
proportional?
|
||||
vf2d(game->GetWrappedTextSizeProp(finalLabel,rect.size.x-4,adjustedScale)):
|
||||
@ -103,6 +105,7 @@ protected:
|
||||
float sizeRatio=(labelTextSize.x)/(rect.size.x-4);
|
||||
if(sizeRatio>1){
|
||||
adjustedScale.x/=sizeRatio;
|
||||
adjustedShadowScale.x/=sizeRatio;
|
||||
labelTextSize.x/=sizeRatio;
|
||||
}
|
||||
}
|
||||
@ -138,9 +141,9 @@ protected:
|
||||
}else{
|
||||
if(shadow){
|
||||
if(proportional){
|
||||
window.DrawShadowStringPropDecal(drawPos,finalLabel,WHITE,BLACK,adjustedScale,adjustedScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-4);
|
||||
window.DrawShadowStringPropDecal(drawPos,finalLabel,WHITE,BLACK,adjustedScale,adjustedShadowScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-4);
|
||||
}else{
|
||||
window.DrawShadowStringDecal(drawPos,finalLabel,WHITE,BLACK,adjustedScale,adjustedScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-4);
|
||||
window.DrawShadowStringDecal(drawPos,finalLabel,WHITE,BLACK,adjustedScale,adjustedShadowScale,fitToLabel?std::numeric_limits<float>::max():rect.size.x-4);
|
||||
}
|
||||
}else{
|
||||
if(proportional){
|
||||
|
||||
@ -269,7 +269,7 @@ void Menu::InitializeMerchantWindow(){
|
||||
auto moneyIcon=merchantWindow->ADD("Money Icon",MenuIconButton)(geom2d::rect<float>{moneyIconPos,{24,24}},GFX["money.png"].Decal(),DO_NOTHING,IconButtonAttr::NOT_SELECTABLE|IconButtonAttr::NO_OUTLINE|IconButtonAttr::NO_BACKGROUND)END;
|
||||
std::string moneyText=std::to_string(game->GetPlayer()->GetMoney());
|
||||
vf2d moneyTextSize=game->GetTextSizeProp(moneyText)*2;
|
||||
auto moneyDisplay=merchantWindow->ADD("Money Label",PlayerMoneyLabel)(geom2d::rect<float>{moneyIconPos-vf2d{2+moneyTextSize.x,-2},moneyTextSize},2,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN|ComponentAttr::FIT_TO_LABEL)END;
|
||||
auto moneyDisplay=merchantWindow->ADD("Money Label",PlayerMoneyLabel)(geom2d::rect<float>{moneyIconPos-vf2d{2+moneyTextSize.x,-2},moneyTextSize},2,1.85f,ComponentAttr::SHADOW|ComponentAttr::LEFT_ALIGN|ComponentAttr::FIT_TO_LABEL)END;
|
||||
moneyDisplay->SetRightAlignment(true);
|
||||
Player::AddMoneyListener(moneyDisplay);
|
||||
#pragma endregion
|
||||
|
||||
@ -1543,7 +1543,8 @@ void Player::PerformHPRecovery(){
|
||||
|
||||
const float Player::GetDamageReductionPct()const{
|
||||
float modDmgReductionPct=0;
|
||||
modDmgReductionPct+=GetEquipStat("Damage Reduction")/100;
|
||||
modDmgReductionPct+=GetEquipStat("Damage Reduction")/100.f;
|
||||
if(HasEnchant("Last Reserve"))modDmgReductionPct+="Last Reserve"_ENC["DAMAGE REDUCTION PCT"]/100.f;
|
||||
return modDmgReductionPct;
|
||||
}
|
||||
|
||||
|
||||
@ -45,8 +45,12 @@ class PlayerMoneyLabel:public MenuLabel{
|
||||
bool rightAligned=false;
|
||||
float anchorPointX=0;
|
||||
public:
|
||||
inline PlayerMoneyLabel(geom2d::rect<float>rect,float scale=1,ComponentAttr attributes=ComponentAttr::NONE)
|
||||
:MenuLabel(rect,std::to_string(game->GetPlayer()->GetMoney()),scale,attributes){}
|
||||
inline PlayerMoneyLabel(geom2d::rect<float>rect,float scale,ComponentAttr attributes=ComponentAttr::NONE)
|
||||
:PlayerMoneyLabel(rect,scale,scale,attributes){}
|
||||
inline PlayerMoneyLabel(geom2d::rect<float>rect,float scale,const float shadowScale,ComponentAttr attributes=ComponentAttr::NONE)
|
||||
:MenuLabel(rect,std::to_string(game->GetPlayer()->GetMoney()),scale,attributes){
|
||||
this->shadowScale=shadowScale;
|
||||
}
|
||||
|
||||
inline virtual void OnPlayerMoneyUpdate(uint32_t newMoney)final{
|
||||
SetLabel(std::to_string(newMoney));
|
||||
|
||||
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 1
|
||||
#define VERSION_MINOR 2
|
||||
#define VERSION_PATCH 3
|
||||
#define VERSION_BUILD 10791
|
||||
#define VERSION_BUILD 10793
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user