From f6997ebd1de555916c491dbd603f7a0e9c1d9c58 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Fri, 4 Aug 2006 00:56:19 +0000 Subject: git-svn-id: svn://mattst88.com/svn/sdlpong/trunk@2 e27a58fc-241a-0410-afba-9958544cdf14 --- color.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 color.c (limited to 'color.c') diff --git a/color.c b/color.c new file mode 100644 index 0000000..3a3fc88 --- /dev/null +++ b/color.c @@ -0,0 +1,24 @@ +#include "SDL.h" +#include +#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; +} -- cgit v1.2.3