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;
|
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());
|
std::string moneyText=std::to_string(game->GetPlayer()->GetMoney());
|
||||||
vf2d moneyTextSize=game->GetTextSizeProp(moneyText)*2;
|
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);
|
moneyDisplay->SetRightAlignment(true);
|
||||||
Player::AddMoneyListener(moneyDisplay);
|
Player::AddMoneyListener(moneyDisplay);
|
||||||
#pragma endregion
|
#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;
|
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());
|
std::string moneyText=std::to_string(game->GetPlayer()->GetMoney());
|
||||||
vf2d moneyTextSize=game->GetTextSizeProp(moneyText)*2;
|
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);
|
moneyDisplay->SetRightAlignment(true);
|
||||||
Player::AddMoneyListener(moneyDisplay);
|
Player::AddMoneyListener(moneyDisplay);
|
||||||
#pragma endregion
|
#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;
|
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());
|
std::string moneyText=std::to_string(game->GetPlayer()->GetMoney());
|
||||||
vf2d moneyTextSize=game->GetTextSizeProp(moneyText)*2;
|
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);
|
moneyDisplay->SetRightAlignment(true);
|
||||||
Player::AddMoneyListener(moneyDisplay);
|
Player::AddMoneyListener(moneyDisplay);
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
@ -48,6 +48,7 @@ INCLUDE_game
|
|||||||
class MenuLabel:public MenuComponent{
|
class MenuLabel:public MenuComponent{
|
||||||
protected:
|
protected:
|
||||||
float scale=1;
|
float scale=1;
|
||||||
|
float shadowScale=1;
|
||||||
bool shadow=false;
|
bool shadow=false;
|
||||||
bool centered=true;
|
bool centered=true;
|
||||||
bool multiLineCentered=false;
|
bool multiLineCentered=false;
|
||||||
@ -68,7 +69,7 @@ public:
|
|||||||
this->onLabelChangeFunc=onLabelChangeFunc;
|
this->onLabelChangeFunc=onLabelChangeFunc;
|
||||||
}
|
}
|
||||||
inline MenuLabel(geom2d::rect<float>rect,std::string label,float scale=1,ComponentAttr attributes=ComponentAttr::NONE)
|
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;
|
border=attributes&ComponentAttr::OUTLINE;
|
||||||
this->background=attributes&ComponentAttr::BACKGROUND;
|
this->background=attributes&ComponentAttr::BACKGROUND;
|
||||||
showDefaultLabel=false;
|
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)+'*';});
|
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();
|
std::string_view finalLabel=censored?censoredTextEntry:GetLabel();
|
||||||
vf2d adjustedScale={scale,scale};
|
vf2d adjustedScale={scale,scale};
|
||||||
|
vf2d adjustedShadowScale={shadowScale,shadowScale};
|
||||||
vf2d labelTextSize=
|
vf2d labelTextSize=
|
||||||
proportional?
|
proportional?
|
||||||
vf2d(game->GetWrappedTextSizeProp(finalLabel,rect.size.x-4,adjustedScale)):
|
vf2d(game->GetWrappedTextSizeProp(finalLabel,rect.size.x-4,adjustedScale)):
|
||||||
@ -103,6 +105,7 @@ protected:
|
|||||||
float sizeRatio=(labelTextSize.x)/(rect.size.x-4);
|
float sizeRatio=(labelTextSize.x)/(rect.size.x-4);
|
||||||
if(sizeRatio>1){
|
if(sizeRatio>1){
|
||||||
adjustedScale.x/=sizeRatio;
|
adjustedScale.x/=sizeRatio;
|
||||||
|
adjustedShadowScale.x/=sizeRatio;
|
||||||
labelTextSize.x/=sizeRatio;
|
labelTextSize.x/=sizeRatio;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -138,9 +141,9 @@ protected:
|
|||||||
}else{
|
}else{
|
||||||
if(shadow){
|
if(shadow){
|
||||||
if(proportional){
|
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{
|
}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{
|
}else{
|
||||||
if(proportional){
|
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;
|
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());
|
std::string moneyText=std::to_string(game->GetPlayer()->GetMoney());
|
||||||
vf2d moneyTextSize=game->GetTextSizeProp(moneyText)*2;
|
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);
|
moneyDisplay->SetRightAlignment(true);
|
||||||
Player::AddMoneyListener(moneyDisplay);
|
Player::AddMoneyListener(moneyDisplay);
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
|
@ -1543,7 +1543,8 @@ void Player::PerformHPRecovery(){
|
|||||||
|
|
||||||
const float Player::GetDamageReductionPct()const{
|
const float Player::GetDamageReductionPct()const{
|
||||||
float modDmgReductionPct=0;
|
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;
|
return modDmgReductionPct;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,8 +45,12 @@ class PlayerMoneyLabel:public MenuLabel{
|
|||||||
bool rightAligned=false;
|
bool rightAligned=false;
|
||||||
float anchorPointX=0;
|
float anchorPointX=0;
|
||||||
public:
|
public:
|
||||||
inline PlayerMoneyLabel(geom2d::rect<float>rect,float scale=1,ComponentAttr attributes=ComponentAttr::NONE)
|
inline PlayerMoneyLabel(geom2d::rect<float>rect,float scale,ComponentAttr attributes=ComponentAttr::NONE)
|
||||||
:MenuLabel(rect,std::to_string(game->GetPlayer()->GetMoney()),scale,attributes){}
|
: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{
|
inline virtual void OnPlayerMoneyUpdate(uint32_t newMoney)final{
|
||||||
SetLabel(std::to_string(newMoney));
|
SetLabel(std::to_string(newMoney));
|
||||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 2
|
#define VERSION_MINOR 2
|
||||||
#define VERSION_PATCH 3
|
#define VERSION_PATCH 3
|
||||||
#define VERSION_BUILD 10791
|
#define VERSION_BUILD 10793
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user