|
|
@ -52,11 +52,22 @@ void Textbox::Update(PixelGameEngine*pge){ |
|
|
|
|
|
|
|
|
|
|
|
void Textbox::Draw(PixelGameEngine*pge,Resources&resources){ |
|
|
|
void Textbox::Draw(PixelGameEngine*pge,Resources&resources){ |
|
|
|
if(visible){ |
|
|
|
if(visible){ |
|
|
|
vf2d finalPos=pos; |
|
|
|
|
|
|
|
geom2d::rect<float>boxRect={pos-vf2d{2,2},maxSize+vf2d{4,4}}; |
|
|
|
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); |
|
|
|
if(boxRect.bottom().start.y>=pge->ScreenHeight()){ |
|
|
|
pge->DrawRectDecal(pos-vf2d{1,1},maxSize+vf2d{3,3},WHITE); |
|
|
|
boxRect.pos-={0,boxRect.bottom().start.y-pge->ScreenHeight()}; |
|
|
|
pge->DrawShadowStringPropDecal(pos+vf2d{1,1},displayText,{220,220,220}); |
|
|
|
} |
|
|
|
|
|
|
|
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}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -80,3 +91,7 @@ void Textbox::UpdateAndDraw(vf2d pos,PixelGameEngine*pge,Resources&resources){ |
|
|
|
Update(pge); |
|
|
|
Update(pge); |
|
|
|
Draw(pge,resources); |
|
|
|
Draw(pge,resources); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vf2d Textbox::GetSize(){ |
|
|
|
|
|
|
|
return maxSize; |
|
|
|
|
|
|
|
} |