|
|
@ -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.
|
|
|
|
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); |
|
|
|
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; |
|
|
|
garbageCollector[key].decal=newDecal; |
|
|
|
pge->SetDrawTarget(newDecal->sprite); |
|
|
|
pge->SetDrawTarget(newDecal->sprite); |
|
|
|
pge->Clear(BLANK); |
|
|
|
pge->Clear(BLANK); |
|
|
|
pge->DrawString({0,0},sText,WHITE,1U,width/scale.x); |
|
|
|
pge->DrawString({0,0},sText,WHITE,1U,width/scale.x); |
|
|
|
newDecal->Update(); |
|
|
|
newDecal->Update(); |
|
|
|
vf2d adjustedShadowSizeFactor=vf2d{shadowSizeFactor,shadowSizeFactor}*4/scale; |
|
|
|
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; |
|
|
|
garbageCollector[key+"_SHADOW"].decal=newShadowDecal; |
|
|
|
pge->SetDrawTarget(newShadowDecal->sprite); |
|
|
|
pge->SetDrawTarget(newShadowDecal->sprite); |
|
|
|
pge->Clear(BLANK); |
|
|
|
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.
|
|
|
|
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); |
|
|
|
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; |
|
|
|
garbageCollector[key].decal=newDecal; |
|
|
|
pge->SetDrawTarget(newDecal->sprite); |
|
|
|
pge->SetDrawTarget(newDecal->sprite); |
|
|
|
pge->Clear(BLANK); |
|
|
|
pge->Clear(BLANK); |
|
|
|
pge->DrawStringProp({0,0},sText,WHITE,1U,width/scale.x); |
|
|
|
pge->DrawStringProp({0,0},sText,WHITE,1U,width/scale.x); |
|
|
|
newDecal->Update(); |
|
|
|
newDecal->Update(); |
|
|
|
vf2d adjustedShadowSizeFactor=vf2d{shadowSizeFactor,shadowSizeFactor}*4/scale; |
|
|
|
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; |
|
|
|
garbageCollector[key+"_SHADOW"].decal=newShadowDecal; |
|
|
|
pge->SetDrawTarget(newShadowDecal->sprite); |
|
|
|
pge->SetDrawTarget(newShadowDecal->sprite); |
|
|
|
pge->Clear(BLANK); |
|
|
|
pge->Clear(BLANK); |
|
|
|