aboutsummaryrefslogtreecommitdiff
path: root/sources/TZR_DrawRectangle.c
blob: 879eabac01c9a38a2ddcb239bd7fe543a8c5df9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "TZR_render.h"
#include "TZR_globals.h"
#include "sdl_error.h"
#include <SDL2/SDL_render.h>

int
TZR_DrawRectangle(bool fill, int x, int y, int w, int h)
{
	const SDL_Rect rect = { x, y, w, h };
	if (fill) {
		if (SDL_RenderFillRect(___tzr_renderer, &rect) < 0)
			return sdl_error(-1);
	} else {
		if (SDL_RenderDrawRect(___tzr_renderer, &rect) < 0)
			return sdl_error(-1);
	}
	return 0;
}