Refactor RectBase to allow blit to RenderTarget
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#include <Event.h>
|
||||
|
||||
#include <Color4.hpp>
|
||||
#include "JGL/types/RenderTarget.h"
|
||||
|
||||
namespace JUI
|
||||
{
|
||||
@@ -77,5 +78,7 @@ namespace JUI
|
||||
Color4 border_color = {192, 192, 192, 0};
|
||||
bool clips_descendants = false; // Controls if child objects can render outside of their parent's rectangle bounds.
|
||||
float corner_rounding_radius = 0.f; // Curves the rectangle corners by N degrees.
|
||||
void Draw(JGL::RenderTarget *canvas, const Color4 &bgColor, const Color4 &borderColor, const Vector2 &abs_pos,
|
||||
const Vector2 &abs_size);
|
||||
};
|
||||
}
|
@@ -35,7 +35,12 @@ namespace JUI {
|
||||
|
||||
void RectBase::Draw(const Color4& bgColor, const Color4& borderColor, const Vector2 &abs_pos, const Vector2 &abs_size) {
|
||||
|
||||
J2D::Begin();
|
||||
Draw(nullptr, bgColor, borderColor, abs_pos, abs_size);
|
||||
}
|
||||
|
||||
void RectBase::Draw(JGL::RenderTarget* canvas, const Color4& bgColor, const Color4& borderColor, const Vector2 &abs_pos, const Vector2 &abs_size) {
|
||||
|
||||
J2D::Begin(canvas, false);
|
||||
|
||||
// Background rect
|
||||
if (corner_rounding_radius > 0)
|
||||
|
Reference in New Issue
Block a user