summaryrefslogtreecommitdiff
path: root/color.c
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2006-08-04 00:56:19 +0000
committerMatt Turner <mattst88@gmail.com>2006-08-04 00:56:19 +0000
commitf6997ebd1de555916c491dbd603f7a0e9c1d9c58 (patch)
tree23645695bcf2c9ddd154d004dfe09693139ffbf0 /color.c
parentf2837ef813150240c00741018542dc271213ff5c (diff)
git-svn-id: svn://mattst88.com/svn/sdlpong/trunk@2 e27a58fc-241a-0410-afba-9958544cdf14HEADmaster
Diffstat (limited to 'color.c')
-rw-r--r--color.c24
1 files changed, 24 insertions, 0 deletions
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 <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;
+}