Naiive & Slow (But correct) implementation of OutlineRoundedRect. Needs to be performance-improved to a contiguous line loop.
All checks were successful
Run ReCI Build Test / Explore-Gitea-Actions (push) Successful in 7m7s

This commit is contained in:
2024-10-16 13:19:42 -04:00
parent cc504c65ec
commit 7f1794e48f
4 changed files with 151 additions and 1 deletions

View File

@@ -58,6 +58,8 @@ namespace JGL {
void DrawPoint(const Color4& color, const Vector2& coordinates, float radius = 1.f);
void DrawPoint(const Color4& color, float x, float y, float radius = 1.f);
void DrawPoints(const Color4& color, const std::vector<Vector2>& points, float radius = 1.f);
/// Plots a line (segment) on the screen.
/// @param color A 3-or-4 channel color value. @see classes Color3, Color4.
/// @param A The starting point of the line segment.
@@ -82,6 +84,14 @@ namespace JGL {
/// Draws a filled rectangle with rounded corners on the screen.
void FillRoundedRect(const Color4& color, const Vector2& pos, const Vector2& size, float radius = 5, unsigned int subdivisions = 8);
/// Draws a filled rectangle with chamfered (beveled) corners on the screen.
void FillChamferRect(const Color4& color, const Vector2& pos, const Vector2& size, float radius = 5);
/// Draws an outline of a rectangle with rounded corners onto the screen.
void OutlineRoundedRect(const Color4& color, const Vector2& pos, const Vector2& size, float radius = 5, float thickness = 1);
void OutlineChamferRect(const Color4& color, const Vector2& pos, const Vector2& size, float radius = 5, float thickness = 1);
/// Draws a render target to the screen.
void DrawRenderTarget(const RenderTarget& render_target, const Vector2& position, float rad_rotation = 0, const Vector2& origin = Vector2(0 , 0),
const Vector2& scale = Vector2(1, 1), const Color4& color = Colors::White, Direction inversion = Direction::None);
@@ -164,8 +174,11 @@ namespace JGL {
/// TODO Implement the following. These ones are going to be extremely annoying.
void FillPolygon(const Color4& color, const std::vector<Vector2>& points);
void FillTexturedPolygon();
void OutlineRoundedRect(const Color4& color, const Vector2& pos, const Vector2& size, float radius = 5, float thickness = 1);
void FillTexturedTriangle();
void DrawArc(const Color4 &color, const Vector2 &center, float radius, float arc_begin, float arc_end,
unsigned int subdivisions, float thickness);
}
/// Drawing functions for primitive 3D Shapes.