aboutsummaryrefslogtreecommitdiff
path: root/sources/TZR_DrawRectangle.c
diff options
context:
space:
mode:
Diffstat (limited to 'sources/TZR_DrawRectangle.c')
-rw-r--r--sources/TZR_DrawRectangle.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sources/TZR_DrawRectangle.c b/sources/TZR_DrawRectangle.c
index 879eaba..0ea81fa 100644
--- a/sources/TZR_DrawRectangle.c
+++ b/sources/TZR_DrawRectangle.c
@@ -4,10 +4,15 @@
#include <SDL2/SDL_render.h>
int
-TZR_DrawRectangle(bool fill, int x, int y, int w, int h)
+_TZR_DrawRectangle(const TZR_DrawRectangleArgs *args)
{
- const SDL_Rect rect = { x, y, w, h };
- if (fill) {
+ const SDL_Rect rect = {
+ args->x - args->center * (args->w / 2),
+ args->y - args->center * (args->h / 2),
+ args->w,
+ args->h
+ };
+ if (args->fill) {
if (SDL_RenderFillRect(___tzr_renderer, &rect) < 0)
return sdl_error(-1);
} else {