diff options
| author | Roberto Esteves <contact@robertoesteves.dev> | 2026-01-05 14:11:50 +0000 |
|---|---|---|
| committer | Roberto Esteves <contact@robertoesteves.dev> | 2026-01-05 14:11:50 +0000 |
| commit | 52c6a7635056ee78d282ba2a55eb26f2663bb577 (patch) | |
| tree | 9d37d851e63e96e53ef3836321f03d4f2839edef /src/command.c | |
| parent | da12440cabe270584ff650703e90db540d2ec4c9 (diff) | |
- add meson build system
- refactor executable to be a test
- remove stdlib from base library
Diffstat (limited to 'src/command.c')
| -rw-r--r-- | src/command.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/command.c b/src/command.c new file mode 100644 index 0000000..735036e --- /dev/null +++ b/src/command.c @@ -0,0 +1,41 @@ +#include "rgl.h" + +void RGL_Rect(RGL_Context *ctx, unsigned int x, unsigned int y, + unsigned int width, unsigned int height) { + RGL_Command *rectCommand = + (RGL_Command *)RGL_ArenaAlloc(&ctx->queue.arena, sizeof(RGL_Command)); + + rectCommand->type = Rect; + rectCommand->data.rect.x = x; + rectCommand->data.rect.y = y; + rectCommand->data.rect.width = width; + rectCommand->data.rect.height = height; + rectCommand->data.rect.color = ctx->color; + + ctx->queue.size += 1; +} + +void RGL_BeginPath(RGL_Context *ctx, RGL_PathVerb verb) { + ctx->current = + (RGL_Command *)RGL_ArenaAlloc(&ctx->queue.arena, sizeof(RGL_Command)); + + ctx->current->type = Path; + ctx->current->data.path.color = ctx->color; + ctx->current->data.path.size = 0; + ctx->current->data.path.verb = verb; +} + +void RGL_PathMoveTo(RGL_Context *ctx, int x, int y) { + RGL_Point *p = + (RGL_Point *)RGL_ArenaAlloc(&ctx->queue.arena, sizeof(RGL_Point)); + p->x = RGL_GetFixedI(x); + p->y = RGL_GetFixedI(y); + + ctx->current->data.path.size += 1; +} + +void RGL_EndPath(RGL_Context *ctx) { + ctx->current->data.path.color = ctx->color; + ctx->current = 0; + ctx->queue.size += 1; +} |