add line drawing

This commit is contained in:
veclavtalica
2025-01-23 03:17:05 +03:00
parent 3f9906a918
commit 2df5616410
6 changed files with 74 additions and 5 deletions

View File

@ -56,6 +56,13 @@ typedef struct SpritePrimitive {
bool repeat;
} SpritePrimitive;
typedef struct LinePrimitive {
Vec2 start;
Vec2 finish;
float thickness;
Color color;
} LinePrimitive;
typedef struct RectPrimitive {
Rect rect;
Color color;
@ -77,6 +84,7 @@ typedef struct TextPrimitive {
typedef enum Primitive2DType {
PRIMITIVE_2D_SPRITE,
PRIMITIVE_2D_LINE,
PRIMITIVE_2D_RECT,
PRIMITIVE_2D_CIRCLE,
PRIMITIVE_2D_TEXT,
@ -87,6 +95,7 @@ typedef struct Primitive2D {
union {
SpritePrimitive sprite;
LinePrimitive line;
RectPrimitive rect;
CirclePrimitive circle;
TextPrimitive text;
@ -288,6 +297,8 @@ VertexBuffer get_circle_element_buffer(void);
void render_circle(const CirclePrimitive *circle);
void render_line(const LinePrimitive *line);
void render_rectangle(const RectPrimitive *rectangle);
void finally_render_quads(Primitive2D const primitives[],