Add in unit size cost.
This commit is contained in:
parent
d61b647fda
commit
fee862adf5
@ -15,7 +15,7 @@ Stage1::Stage1(VirusAttack*game)
|
||||
|
||||
|
||||
void Stage1::Update(){
|
||||
|
||||
|
||||
}
|
||||
void Stage1::Draw(){
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ void Textbox::Draw(PixelGameEngine*pge,Resources&resources,std::map<Image,std::u
|
||||
pge->DrawShadowStringPropDecal(boxRect.pos+vf2d{3,3},displayHeaderText,{245, 218, 66});
|
||||
pge->DrawShadowStringPropDecal(boxRect.pos+vf2d{3.f,float(3+pge->GetTextSizeProp(displayHeaderText).y)},displayText,{220,220,220});
|
||||
if(resourceCost.size()>0){
|
||||
geom2d::rect<float>resourceBoxRect={boxRect.pos+vf2d{6+maxSize.x,6},{36,36}};
|
||||
geom2d::rect<float>resourceBoxRect={boxRect.pos+vf2d{6+maxSize.x,0},{36,42}};
|
||||
pge->FillRectDecal(resourceBoxRect.pos,resourceBoxRect.size,backCol);
|
||||
pge->DrawRectDecal(resourceBoxRect.pos+vf2d{1,1},resourceBoxRect.size-vf2d{2,2},WHITE);
|
||||
vf2d contentPos=resourceBoxRect.pos+vf2d{3,3};
|
||||
@ -112,31 +112,41 @@ void Textbox::Draw(PixelGameEngine*pge,Resources&resources,std::map<Image,std::u
|
||||
};
|
||||
|
||||
int index=0;
|
||||
int totalCost=0;
|
||||
if(util::GetHealthCost(resourceCost)!=-1){
|
||||
DrawResourceAmount(index,util::GetHealthCost(resourceCost),resources.health);
|
||||
pge->DrawDecal(contentPos+vf2d{0,index*6.f},IMAGES[RESOURCE]->Decal(),{0.5,0.5},CONSTANT::HEALTH_COLOR);
|
||||
totalCost+=util::GetHealthCost(resourceCost);
|
||||
index++;
|
||||
}
|
||||
if(util::GetAtkSpdCost(resourceCost)!=-1){
|
||||
DrawResourceAmount(index,util::GetAtkSpdCost(resourceCost),resources.atkSpd);
|
||||
pge->DrawDecal(contentPos+vf2d{0,index*6.f},IMAGES[RESOURCE]->Decal(),{0.5,0.5},CONSTANT::ATKSPD_COLOR);
|
||||
totalCost+=util::GetAtkSpdCost(resourceCost);
|
||||
index++;
|
||||
}
|
||||
if(util::GetMoveSpdCost(resourceCost)!=-1){
|
||||
DrawResourceAmount(index,util::GetMoveSpdCost(resourceCost),resources.moveSpd);
|
||||
pge->DrawDecal(contentPos+vf2d{0,index*6.f},IMAGES[RESOURCE]->Decal(),{0.5,0.5},CONSTANT::MOVESPD_COLOR);
|
||||
totalCost+=util::GetMoveSpdCost(resourceCost);
|
||||
index++;
|
||||
}
|
||||
if(util::GetRangeCost(resourceCost)!=-1){
|
||||
DrawResourceAmount(index,util::GetRangeCost(resourceCost),resources.range);
|
||||
pge->DrawDecal(contentPos+vf2d{0,index*6.f},IMAGES[RESOURCE]->Decal(),{0.5,0.5},CONSTANT::RANGE_COLOR);
|
||||
totalCost+=util::GetRangeCost(resourceCost);
|
||||
index++;
|
||||
}
|
||||
if(util::GetProcedureCost(resourceCost)!=-1){
|
||||
DrawResourceAmount(index,util::GetProcedureCost(resourceCost),resources.procedure);
|
||||
pge->DrawDecal(contentPos+vf2d{0,index*6.f},IMAGES[RESOURCE]->Decal(),{0.5,0.5},CONSTANT::PROCEDURE_COLOR);
|
||||
totalCost+=util::GetProcedureCost(resourceCost);
|
||||
index++;
|
||||
}
|
||||
std::string text="Size: "+std::to_string(totalCost)+" bytes";
|
||||
vi2d size=pge->GetTextSizeProp(text);
|
||||
pge->DrawShadowStringPropDecal(contentPos+vf2d{0,index*6.f+1},text,WHITE,BLACK,{30/float(size.x),0.5},0.6);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,6 +26,7 @@ struct Letter{
|
||||
|
||||
class VirusAttack : public olc::PixelGameEngine
|
||||
{
|
||||
friend class Stage1;
|
||||
private:
|
||||
#ifdef SPLASH_ENABLED
|
||||
SplashScreen splash;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user