|
|
|
@ -68,7 +68,7 @@ void Textbox::Update(PixelGameEngine*pge){ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void Textbox::Draw(PixelGameEngine*pge,Resources&resources,std::map<Image,std::unique_ptr<Renderable>>&IMAGES){ |
|
|
|
|
void Textbox::Draw(PixelGameEngine*pge,Resources&resources,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,int totalUsedMemory,int memoryLimit){ |
|
|
|
|
if(visible){ |
|
|
|
|
geom2d::rect<float>boxRect={pos-vf2d{3,3},maxSize+vf2d{6,6}}; |
|
|
|
|
if(resourceCost.size()>0){ |
|
|
|
@ -145,7 +145,12 @@ void Textbox::Draw(PixelGameEngine*pge,Resources&resources,std::map<Image,std::u |
|
|
|
|
} |
|
|
|
|
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); |
|
|
|
|
drawcol=WHITE; |
|
|
|
|
if(totalCost+totalUsedMemory>memoryLimit){ |
|
|
|
|
pge->FillRectDecal(contentPos+vf2d{-1,float(index*6)},vf2d{resourceBoxRect.size.x-4,7},{160,0,0,192}); |
|
|
|
|
drawcol=RED; |
|
|
|
|
} |
|
|
|
|
pge->DrawShadowStringPropDecal(contentPos+vf2d{0,index*6.f+1},text,drawcol,BLACK,{30/float(size.x),0.5},0.6); |
|
|
|
|
index++; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -166,10 +171,10 @@ void Textbox::SetVisible(bool visible){ |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void Textbox::UpdateAndDraw(vf2d pos,PixelGameEngine*pge,Resources&resources,std::map<Image,std::unique_ptr<Renderable>>&IMAGES){ |
|
|
|
|
void Textbox::UpdateAndDraw(vf2d pos,PixelGameEngine*pge,Resources&resources,std::map<Image,std::unique_ptr<Renderable>>&IMAGES,int totalUsedMemory,int memoryLimit){ |
|
|
|
|
UpdatePosition(pos); |
|
|
|
|
Update(pge); |
|
|
|
|
Draw(pge,resources,IMAGES); |
|
|
|
|
Draw(pge,resources,IMAGES,totalUsedMemory,memoryLimit); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
vf2d Textbox::GetSize(){ |
|
|
|
|