Fix shadow string rendering for vertical scaling.
This commit is contained in:
parent
330ceefc5b
commit
b8dea862f6
@ -97,9 +97,9 @@ void Menu::InitializeBlacksmithCraftingWindow(){
|
||||
const std::weak_ptr<Item>item=comp.lock()->GetItem();
|
||||
|
||||
std::string label="";
|
||||
if(Inventory::GetItemCount(item.lock()->ActualName)==0){ //If we don't own the item we have to create it first.
|
||||
if(Inventory::GetItemCount(item.lock()->ActualName())==0){ //If we don't own the item we have to create it first.
|
||||
if(item.lock()->EnhancementIsPossible()&&item.lock()->GetEnhancementInfo().size()>item.lock()->EnhancementLevel()+1){
|
||||
label=std::format("#00FF00Craft {}",item.lock()->GetDisplayName());
|
||||
label=std::format("#00FF00Craft {}",item.lock()->DisplayName());
|
||||
}
|
||||
Component<MenuLabel>(CRAFT_ITEM,"Enhancement Level Header")->SetLabel(label);
|
||||
Component<MenuLabel>(CRAFT_ITEM,"Item Name Header")->SetLabel(std::format("Crafting {}",item.lock()->DisplayName()));
|
||||
@ -111,7 +111,7 @@ void Menu::InitializeBlacksmithCraftingWindow(){
|
||||
label=std::format("Level {} ->#00AA00 {}",item.lock()->EnhancementLevel(),item.lock()->EnhancementLevel()+1);
|
||||
}
|
||||
Component<MenuLabel>(CRAFT_ITEM,"Enhancement Level Header")->SetLabel(label);
|
||||
Component<MenuLabel>(CRAFT_ITEM,"Item Name Header")->SetLabel(std::format("Crafting {}",item.lock()->DisplayName()));
|
||||
Component<MenuLabel>(CRAFT_ITEM,"Item Name Header")->SetLabel(std::format("Enhancing {}",item.lock()->DisplayName()));
|
||||
Component<EnhancementStatsLabel>(CRAFT_ITEM,"Enhancement Stats Label")->SetItem(item);
|
||||
Component<RequiredMaterialsList>(CRAFT_ITEM,"Required Materials List")->SetItem(item);
|
||||
Component<MenuComponent>(CRAFT_ITEM,"Craft Button")->SetGrayedOut(!item.lock()->CanEnhanceItem());
|
||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 3
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_BUILD 6605
|
||||
#define VERSION_BUILD 6609
|
||||
|
||||
#define stringify(a) stringify_(a)
|
||||
#define stringify_(a) #a
|
||||
|
@ -729,14 +729,14 @@ void olc::ViewPort::DrawShadowStringDecal(const olc::vf2d& pos, std::string_view
|
||||
}
|
||||
if(!garbageCollector.count(key)){ //If the text key already exists, don't have to recreate the decal, just update the expire time.
|
||||
vi2d imageSize=pge->GetWrappedTextSize(sText,width,scale);
|
||||
Decal*newDecal=new Decal(new Sprite(imageSize.x/scale.x,imageSize.y/scale.x));
|
||||
Decal*newDecal=new Decal(new Sprite(imageSize.x/scale.x,imageSize.x/scale.x));
|
||||
garbageCollector[key].decal=newDecal;
|
||||
pge->SetDrawTarget(newDecal->sprite);
|
||||
pge->Clear(BLANK);
|
||||
pge->DrawString({0,0},sText,WHITE,1U,width/scale.x);
|
||||
newDecal->Update();
|
||||
vf2d adjustedShadowSizeFactor=vf2d{shadowSizeFactor,shadowSizeFactor}*4/scale;
|
||||
Decal*newShadowDecal=new Decal(new Sprite((imageSize.x/scale.x*4)+adjustedShadowSizeFactor.x*2,(imageSize.y/scale.x*4)+adjustedShadowSizeFactor.y*2));
|
||||
Decal*newShadowDecal=new Decal(new Sprite((imageSize.x/scale.x*4)+adjustedShadowSizeFactor.x*2,(imageSize.x/scale.x*4)+adjustedShadowSizeFactor.y*2));
|
||||
garbageCollector[key+"_SHADOW"].decal=newShadowDecal;
|
||||
pge->SetDrawTarget(newShadowDecal->sprite);
|
||||
pge->Clear(BLANK);
|
||||
@ -777,14 +777,14 @@ void olc::ViewPort::DrawShadowStringPropDecal(const olc::vf2d& pos, std::string_
|
||||
}
|
||||
if(!garbageCollector.count(key)){ //If the text key already exists, don't have to recreate the decal, just update the expire time.
|
||||
vi2d imageSize=pge->GetWrappedTextSizeProp(sText,width,scale);
|
||||
Decal*newDecal=new Decal(new Sprite(imageSize.x/scale.x,imageSize.y/scale.x));
|
||||
Decal*newDecal=new Decal(new Sprite(imageSize.x/scale.x,imageSize.x/scale.x));
|
||||
garbageCollector[key].decal=newDecal;
|
||||
pge->SetDrawTarget(newDecal->sprite);
|
||||
pge->Clear(BLANK);
|
||||
pge->DrawStringProp({0,0},sText,WHITE,1U,width/scale.x);
|
||||
newDecal->Update();
|
||||
vf2d adjustedShadowSizeFactor=vf2d{shadowSizeFactor,shadowSizeFactor}*4/scale;
|
||||
Decal*newShadowDecal=new Decal(new Sprite((imageSize.x/scale.x*4)+adjustedShadowSizeFactor.x*2,(imageSize.y/scale.x*4)+adjustedShadowSizeFactor.y*2));
|
||||
Decal*newShadowDecal=new Decal(new Sprite((imageSize.x/scale.x*4)+adjustedShadowSizeFactor.x*2,(imageSize.x/scale.x*4)+adjustedShadowSizeFactor.y*2));
|
||||
garbageCollector[key+"_SHADOW"].decal=newShadowDecal;
|
||||
pge->SetDrawTarget(newShadowDecal->sprite);
|
||||
pge->Clear(BLANK);
|
||||
|
@ -3455,14 +3455,14 @@ namespace olc
|
||||
}
|
||||
if(!garbageCollector.count(key)){ //If the text key already exists, don't have to recreate the decal, just update the expire time.
|
||||
vi2d imageSize=GetWrappedTextSize(sText,width,scale);
|
||||
Decal*newDecal=new Decal(new Sprite(imageSize.x/scale.x,imageSize.y/scale.x));
|
||||
Decal*newDecal=new Decal(new Sprite(imageSize.x/scale.x,imageSize.x/scale.x));
|
||||
garbageCollector[key].decal=newDecal;
|
||||
SetDrawTarget(newDecal->sprite);
|
||||
Clear(BLANK);
|
||||
DrawString({0,0},sText,WHITE,1U,width/scale.x);
|
||||
newDecal->Update();
|
||||
vf2d adjustedShadowSizeFactor=vf2d{shadowSizeFactor,shadowSizeFactor}*4/scale;
|
||||
Decal*newShadowDecal=new Decal(new Sprite((imageSize.x/scale.x*4)+adjustedShadowSizeFactor.x*2,(imageSize.y/scale.x*4)+adjustedShadowSizeFactor.y*2));
|
||||
Decal*newShadowDecal=new Decal(new Sprite((imageSize.x/scale.x*4)+adjustedShadowSizeFactor.x*2,(imageSize.x/scale.x*4)+adjustedShadowSizeFactor.y*2));
|
||||
garbageCollector[key+"_SHADOW"].decal=newShadowDecal;
|
||||
SetDrawTarget(newShadowDecal->sprite);
|
||||
Clear(BLANK);
|
||||
@ -3579,14 +3579,14 @@ namespace olc
|
||||
}
|
||||
if(!garbageCollector.count(key)){ //If the text key already exists, don't have to recreate the decal, just update the expire time.
|
||||
vi2d imageSize=GetWrappedTextSizeProp(sText,width,scale);
|
||||
Decal*newDecal=new Decal(new Sprite(imageSize.x/scale.x,imageSize.y/scale.x));
|
||||
Decal*newDecal=new Decal(new Sprite(imageSize.x/scale.x,imageSize.x/scale.x));
|
||||
garbageCollector[key].decal=newDecal;
|
||||
SetDrawTarget(newDecal->sprite);
|
||||
Clear(BLANK);
|
||||
DrawStringProp({0,0},sText,WHITE,1U,width/scale.x);
|
||||
newDecal->Update();
|
||||
vf2d adjustedShadowSizeFactor=vf2d{shadowSizeFactor,shadowSizeFactor}*4/scale;
|
||||
Decal*newShadowDecal=new Decal(new Sprite((imageSize.x/scale.x*4)+adjustedShadowSizeFactor.x*2,(imageSize.y/scale.x*4)+adjustedShadowSizeFactor.y*2));
|
||||
Decal*newShadowDecal=new Decal(new Sprite((imageSize.x/scale.x*4)+adjustedShadowSizeFactor.x*2,(imageSize.x/scale.x*4)+adjustedShadowSizeFactor.y*2));
|
||||
garbageCollector[key+"_SHADOW"].decal=newShadowDecal;
|
||||
SetDrawTarget(newShadowDecal->sprite);
|
||||
Clear(BLANK);
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user