1 /*-------------------------------------------------------------------------------
2 
3 	BARONY
4 	File: colors.hpp
5 	Desc: I can see the rainbow.
6 
7 	Copyright 2013-2016 (c) Turning Wheel LLC, all rights reserved.
8 	See LICENSE for details.
9 
10 -------------------------------------------------------------------------------*/
11 
12 #pragma once
13 
14 /*
15  * SDL_Color colors.
16  */
17 static const SDL_Color sdlColorWhite = { 255, 255, 255, 255 };
18 
19 
20 /*
21  * The following functions generate the corresponding color Uint32s from the given surface.
22  */
uint32ColorWhite(const SDL_Surface & surface)23 inline Uint32 uint32ColorWhite(const SDL_Surface& surface)
24 {
25 	return SDL_MapRGB(surface.format, 255, 255, 255);
26 }
27 
uint32ColorGray(const SDL_Surface & surface)28 inline Uint32 uint32ColorGray(const SDL_Surface& surface)
29 {
30 	return SDL_MapRGB(surface.format, 127, 127, 127);
31 }
32 
uint32ColorBlue(const SDL_Surface & surface)33 inline Uint32 uint32ColorBlue(const SDL_Surface& surface)
34 {
35 	return SDL_MapRGBA(surface.format, 0, 92, 255, 255);
36 }
37 
uint32ColorLightBlue(const SDL_Surface & surface)38 inline Uint32 uint32ColorLightBlue(const SDL_Surface& surface)
39 {
40 	return SDL_MapRGBA(surface.format, 0, 255, 255, 255);
41 }
42 
uint32ColorBaronyBlue(const SDL_Surface & surface)43 inline Uint32 uint32ColorBaronyBlue(const SDL_Surface& surface)
44 {
45 	return SDL_MapRGBA(surface.format, 0, 192, 255, 255); //Dodger Blue. Apparently.
46 }
47 
uint32ColorRed(const SDL_Surface & surface)48 inline Uint32 uint32ColorRed(const SDL_Surface& surface)
49 {
50 	return SDL_MapRGBA(surface.format, 255, 0, 0, 255);
51 }
52 
uint32ColorGreen(const SDL_Surface & surface)53 inline Uint32 uint32ColorGreen(const SDL_Surface& surface)
54 {
55 	return SDL_MapRGBA(surface.format, 0, 255, 0, 255);
56 }
57 
uint32ColorOrange(const SDL_Surface & surface)58 inline Uint32 uint32ColorOrange(const SDL_Surface& surface)
59 {
60 	return SDL_MapRGBA(surface.format, 255, 128, 0, 255);
61 }
62 
uint32ColorYellow(const SDL_Surface & surface)63 inline Uint32 uint32ColorYellow(const SDL_Surface& surface)
64 {
65 	return SDL_MapRGBA(surface.format, 255, 255, 0, 255);
66 }
67