summaryrefslogtreecommitdiff
path: root/color.c
blob: 3a3fc88b7ee887a3e6633115f2389e49a7c5c00c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "SDL.h"
#include <stdlib.h>
#include "color.h"

Color_t * CreateColor(Uint8 r, Uint8 g, Uint8 b) {
	Color_t * newcolor;
	newcolor = malloc(sizeof(Color_t));
	newcolor->components.r = r;
	newcolor->components.g = g;
	newcolor->components.b = b;
	newcolor->color = SDL_MapRGB(SDL_GetVideoSurface()->format, r, g, b);
	return newcolor;
}

Color_t * CreateColorAlpha(Uint8 r, Uint8 g, Uint8 b, Uint8 a) {
	Color_t * newcolor;
	newcolor = malloc(sizeof(Color_t));
	newcolor->components.r = r;
	newcolor->components.g = g;
	newcolor->components.b = b;
	newcolor->alpha = a;
	newcolor->color = SDL_MapRGBA(SDL_GetVideoSurface()->format, r, g, b, a);
	return newcolor;
}