aboutsummaryrefslogtreecommitdiff
path: root/src/sdl/color.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sdl/color.c')
-rw-r--r--src/sdl/color.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/sdl/color.c b/src/sdl/color.c
index 1e75cb6..cb94095 100644
--- a/src/sdl/color.c
+++ b/src/sdl/color.c
@@ -1,5 +1,6 @@
#include <stdbool.h>
#include "color.h"
+#include "util.h"
static const SDL_Color
PALETTE[] = {
@@ -14,12 +15,17 @@ PALETTE[] = {
{ 0, 0, 0, 0 }, // COLOR_LAST
};
-bool
+void
set_color(
SDL_Renderer * const renderer,
const color_t ofs
) {
- // FIXME: check for error?
+ if (ofs >= COLOR_LAST) {
+ die("set_color(): invalid color");
+ }
+
const SDL_Color c = PALETTE[ofs];
- return SDL_SetRenderDrawColor(renderer, c.r, c.g, c.b, c.a) < 0;
+ if (SDL_SetRenderDrawColor(renderer, c.r, c.g, c.b, c.a)) {
+ die("SDL_SetRenderDrawColor(): %s", SDL_GetError());
+ }
}