Add CRenderTools::DrawRect/4 and make DrawUIRect/4 delegates

So usages of `DrawRoundRect/Ext` can more easily be replaced with `DrawRect/4` and so the basic draw methods can be moved to the engine graphics without depending on the `CUIRect` class.
This commit is contained in:
Robert Müller 2022-07-09 17:16:14 +02:00
parent ebf6ce4d27
commit a0ef36847b
2 changed files with 18 additions and 9 deletions

View file

@ -507,24 +507,31 @@ void CRenderTools::DrawRoundRect(float x, float y, float w, float h, float r)
DrawRoundRectExt(x, y, w, h, r, 0xf);
}
void CRenderTools::DrawUIRect(const CUIRect *pRect, ColorRGBA Color, int Corners, float Rounding)
void CRenderTools::DrawRect(float x, float y, float w, float h, ColorRGBA Color, int Corners, float Rounding)
{
Graphics()->TextureClear();
// TODO: FIX US
Graphics()->QuadsBegin();
Graphics()->SetColor(Color);
DrawRoundRectExt(pRect->x, pRect->y, pRect->w, pRect->h, Rounding, Corners);
DrawRoundRectExt(x, y, w, h, Rounding, Corners);
Graphics()->QuadsEnd();
}
void CRenderTools::DrawUIRect(const CUIRect *pRect, ColorRGBA Color, int Corners, float Rounding)
{
DrawRect(pRect->x, pRect->y, pRect->w, pRect->h, Color, Corners, Rounding);
}
void CRenderTools::DrawRect4(float x, float y, float w, float h, vec4 ColorTopLeft, vec4 ColorTopRight, vec4 ColorBottomLeft, vec4 ColorBottomRight, int Corners, float Rounding)
{
Graphics()->TextureClear();
Graphics()->QuadsBegin();
DrawRoundRectExt4(x, y, w, h, ColorTopLeft, ColorTopRight, ColorBottomLeft, ColorBottomRight, Rounding, Corners);
Graphics()->QuadsEnd();
}
void CRenderTools::DrawUIRect4(const CUIRect *pRect, vec4 ColorTopLeft, vec4 ColorTopRight, vec4 ColorBottomLeft, vec4 ColorBottomRight, int Corners, float Rounding)
{
Graphics()->TextureClear();
Graphics()->QuadsBegin();
DrawRoundRectExt4(pRect->x, pRect->y, pRect->w, pRect->h, ColorTopLeft, ColorTopRight, ColorBottomLeft, ColorBottomRight, Rounding, Corners);
Graphics()->QuadsEnd();
DrawRect4(pRect->x, pRect->y, pRect->w, pRect->h, ColorTopLeft, ColorTopRight, ColorBottomLeft, ColorBottomRight, Corners, Rounding);
}
void CRenderTools::DrawCircle(float x, float y, float r, int Segments)

View file

@ -113,7 +113,9 @@ public:
void DrawUIElRect(CUIElement::SUIElementRect &ElUIRect, const CUIRect *pRect, ColorRGBA Color, int Corners, float Rounding);
void DrawRect(float x, float y, float w, float h, ColorRGBA Color, int Corners, float Rounding);
void DrawUIRect(const CUIRect *pRect, ColorRGBA Color, int Corners, float Rounding);
void DrawRect4(float x, float y, float w, float h, vec4 ColorTopLeft, vec4 ColorTopRight, vec4 ColorBottomLeft, vec4 ColorBottomRight, int Corners, float Rounding);
void DrawUIRect4(const CUIRect *pRect, vec4 ColorTopLeft, vec4 ColorTopRight, vec4 ColorBottomLeft, vec4 ColorBottomRight, int Corners, float Rounding);
void DrawCircle(float x, float y, float r, int Segments);