|
|
|
@ -52,11 +52,22 @@ void Textbox::Update(PixelGameEngine*pge){ |
|
|
|
|
|
|
|
|
|
void Textbox::Draw(PixelGameEngine*pge,Resources&resources){ |
|
|
|
|
if(visible){ |
|
|
|
|
vf2d finalPos=pos; |
|
|
|
|
geom2d::rect<float>boxRect={pos-vf2d{2,2},maxSize+vf2d{4,4}}; |
|
|
|
|
pge->FillRectDecal(pos-vf2d{2,2},maxSize+vf2d{4,4},VERY_DARK_GREEN); |
|
|
|
|
pge->DrawRectDecal(pos-vf2d{1,1},maxSize+vf2d{3,3},WHITE); |
|
|
|
|
pge->DrawShadowStringPropDecal(pos+vf2d{1,1},displayText,{220,220,220}); |
|
|
|
|
if(boxRect.bottom().start.y>=pge->ScreenHeight()){ |
|
|
|
|
boxRect.pos-={0,boxRect.bottom().start.y-pge->ScreenHeight()}; |
|
|
|
|
} |
|
|
|
|
if(boxRect.right().start.x>=pge->ScreenWidth()){ |
|
|
|
|
boxRect.pos-={boxRect.right().start.x-pge->ScreenWidth(),0}; |
|
|
|
|
} |
|
|
|
|
if(boxRect.top().start.y<0){ |
|
|
|
|
boxRect.pos+={0,-boxRect.top().start.y}; |
|
|
|
|
} |
|
|
|
|
if(boxRect.left().start.x<0){ |
|
|
|
|
boxRect.pos+={-boxRect.left().start.x,0}; |
|
|
|
|
} |
|
|
|
|
pge->FillRectDecal(boxRect.pos,maxSize+vf2d{4,4},VERY_DARK_GREEN); |
|
|
|
|
pge->DrawRectDecal(boxRect.pos+vf2d{1,1},maxSize+vf2d{3,3},WHITE); |
|
|
|
|
pge->DrawShadowStringPropDecal(boxRect.pos+vf2d{3,3},displayText,{220,220,220}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -79,4 +90,8 @@ void Textbox::UpdateAndDraw(vf2d pos,PixelGameEngine*pge,Resources&resources){ |
|
|
|
|
UpdatePosition(pos); |
|
|
|
|
Update(pge); |
|
|
|
|
Draw(pge,resources); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
vf2d Textbox::GetSize(){ |
|
|
|
|
return maxSize; |
|
|
|
|
} |