Permalink
Browse files

* Made all the colours constant as they should be.

  • Loading branch information...
1 parent 6b8705a commit e9fa99108f93e8e2ec6fbe20c79d690431b8a3be @bobbens committed Jan 22, 2012
View
@@ -354,7 +354,7 @@ static void bkg_sort( background_image_t *arr )
* @brief Adds a new background image.
*/
unsigned int background_addImage( glTexture *image, double x, double y,
- double move, double scale, glColour *col, int foreground )
+ double move, double scale, const glColour *col, int foreground )
{
background_image_t *bkg, **arr;
View
@@ -17,7 +17,7 @@ void background_render( double dt );
/* Add images. */
unsigned int background_addImage( glTexture *image, double x, double y,
- double move, double scale, glColour *col, int foreground );
+ double move, double scale, const glColour *col, int foreground );
/* Stars. */
void background_initStars( int n );
View
@@ -25,83 +25,83 @@
* default colours
*/
/* grey */
-glColour cWhite = { .r=1.00, .g=1.00, .b=1.00, .a=1. }; /**< White */
-glColour cGrey90 = { .r=0.90, .g=0.90, .b=0.90, .a=1. }; /**< Grey 90% */
-glColour cGrey80 = { .r=0.80, .g=0.80, .b=0.80, .a=1. }; /**< Grey 80% */
-glColour cGrey70 = { .r=0.70, .g=0.70, .b=0.70, .a=1. }; /**< Grey 70% */
-glColour cGrey60 = { .r=0.60, .g=0.60, .b=0.60, .a=1. }; /**< Grey 60% */
-glColour cGrey50 = { .r=0.50, .g=0.50, .b=0.50, .a=1. }; /**< Grey 50% */
-glColour cGrey40 = { .r=0.40, .g=0.40, .b=0.40, .a=1. }; /**< Grey 40% */
-glColour cGrey30 = { .r=0.30, .g=0.30, .b=0.30, .a=1. }; /**< Grey 30% */
-glColour cGrey20 = { .r=0.20, .g=0.20, .b=0.20, .a=1. }; /**< Grey 20% */
-glColour cGrey10 = { .r=0.10, .g=0.10, .b=0.10, .a=1. }; /**< Grey 10% */
-glColour cBlack = { .r=0.00, .g=0.00, .b=0.00, .a=1. }; /**< Black */
+const glColour cWhite = { .r=1.00, .g=1.00, .b=1.00, .a=1. }; /**< White */
+const glColour cGrey90 = { .r=0.90, .g=0.90, .b=0.90, .a=1. }; /**< Grey 90% */
+const glColour cGrey80 = { .r=0.80, .g=0.80, .b=0.80, .a=1. }; /**< Grey 80% */
+const glColour cGrey70 = { .r=0.70, .g=0.70, .b=0.70, .a=1. }; /**< Grey 70% */
+const glColour cGrey60 = { .r=0.60, .g=0.60, .b=0.60, .a=1. }; /**< Grey 60% */
+const glColour cGrey50 = { .r=0.50, .g=0.50, .b=0.50, .a=1. }; /**< Grey 50% */
+const glColour cGrey40 = { .r=0.40, .g=0.40, .b=0.40, .a=1. }; /**< Grey 40% */
+const glColour cGrey30 = { .r=0.30, .g=0.30, .b=0.30, .a=1. }; /**< Grey 30% */
+const glColour cGrey20 = { .r=0.20, .g=0.20, .b=0.20, .a=1. }; /**< Grey 20% */
+const glColour cGrey10 = { .r=0.10, .g=0.10, .b=0.10, .a=1. }; /**< Grey 10% */
+const glColour cBlack = { .r=0.00, .g=0.00, .b=0.00, .a=1. }; /**< Black */
/* Greens. */
-glColour cGreen = { .r=0.20, .g=0.80, .b=0.20, .a=1. }; /**< Green */
+const glColour cGreen = { .r=0.20, .g=0.80, .b=0.20, .a=1. }; /**< Green */
/* Reds. */
-glColour cDarkRed = { .r=0.60, .g=0.10, .b=0.10, .a=1. }; /**< Dark Red */
-glColour cRed = { .r=0.80, .g=0.20, .b=0.20, .a=1. }; /**< Red */
+const glColour cDarkRed = { .r=0.60, .g=0.10, .b=0.10, .a=1. }; /**< Dark Red */
+const glColour cRed = { .r=0.80, .g=0.20, .b=0.20, .a=1. }; /**< Red */
/* Oranges. */
-glColour cOrange = { .r=0.90, .g=0.70, .b=0.10, .a=1. }; /**< Orange */
+const glColour cOrange = { .r=0.90, .g=0.70, .b=0.10, .a=1. }; /**< Orange */
/* Yellows. */
-glColour cGold = { .r=1.00, .g=0.84, .b=0.00, .a=1. }; /**< Gold */
-glColour cYellow = { .r=0.80, .g=0.80, .b=0.00, .a=1. }; /**< Yellow */
+const glColour cGold = { .r=1.00, .g=0.84, .b=0.00, .a=1. }; /**< Gold */
+const glColour cYellow = { .r=0.80, .g=0.80, .b=0.00, .a=1. }; /**< Yellow */
/* Blues. */
-glColour cMidnightBlue = { .r=0.40, .g=0.4, .b=0.60, .a=1. }; /**< Midnight Blue. */
-glColour cDarkBlue = { .r=0.10, .g=0.10, .b=0.60, .a=1. }; /**< Dark Blue */
-glColour cBlue = { .r=0.20, .g=0.20, .b=0.80, .a=1. }; /**< Blue */
-glColour cLightBlue = { .r=0.40, .g=0.40, .b=1.00, .a=1. }; /**< Light Blue */
-glColour cCyan = { .r=0.00, .g=1.00, .b=1.00, .a=1. }; /* Cyan. */
+const glColour cMidnightBlue = { .r=0.40, .g=0.4, .b=0.60, .a=1. }; /**< Midnight Blue. */
+const glColour cDarkBlue = { .r=0.10, .g=0.10, .b=0.60, .a=1. }; /**< Dark Blue */
+const glColour cBlue = { .r=0.20, .g=0.20, .b=0.80, .a=1. }; /**< Blue */
+const glColour cLightBlue = { .r=0.40, .g=0.40, .b=1.00, .a=1. }; /**< Light Blue */
+const glColour cCyan = { .r=0.00, .g=1.00, .b=1.00, .a=1. }; /* Cyan. */
/* Purples. */
-glColour cPurple = { .r=0.90, .g=0.10, .b=0.90, .a=1. }; /**< Purple */
-glColour cDarkPurple = { .r=0.68, .g=0.18, .b=0.64, .a=1. }; /**< Dark Purple */
+const glColour cPurple = { .r=0.90, .g=0.10, .b=0.90, .a=1. }; /**< Purple */
+const glColour cDarkPurple = { .r=0.68, .g=0.18, .b=0.64, .a=1. }; /**< Dark Purple */
/* Browns. */
-glColour cBrown = { .r=0.59, .g=0.28, .b=0.00, .a=1. }; /**< Brown */
+const glColour cBrown = { .r=0.59, .g=0.28, .b=0.00, .a=1. }; /**< Brown */
/* Misc. */
-glColour cSilver = { .r=0.75, .g=0.75, .b=0.75, .a=1. }; /**< Silver */
-glColour cAqua = { .r=0.00, .g=0.75, .b=1.00, .a=1. }; /**< Aqua */
+const glColour cSilver = { .r=0.75, .g=0.75, .b=0.75, .a=1. }; /**< Silver */
+const glColour cAqua = { .r=0.00, .g=0.75, .b=1.00, .a=1. }; /**< Aqua */
/*
* game specific
*/
-glColour cBlackHilight = { .r = 0.0, .g = 0.0, .b = 0.0, .a = 0.4 }; /**< Hilight colour over black background. */
-glColour cConsole = { .r = 0.1, .g = 0.9, .b = 0.1, .a = 1. }; /**< Console colour */
-glColour cDConsole = { .r = 0.0, .g = 0.7, .b = 0.0, .a = 1. }; /**< Dark Console colour */
+const glColour cBlackHilight = { .r = 0.0, .g = 0.0, .b = 0.0, .a = 0.4 }; /**< Hilight colour over black background. */
+const glColour cConsole = { .r = 0.1, .g = 0.9, .b = 0.1, .a = 1. }; /**< Console colour */
+const glColour cDConsole = { .r = 0.0, .g = 0.7, .b = 0.0, .a = 1. }; /**< Dark Console colour */
/* toolkit */
-glColour cHilight = { .r = 0.1, .g = 0.9, .b = 0.1, .a = 0.3 }; /**< Hilight colour */
+const glColour cHilight = { .r = 0.1, .g = 0.9, .b = 0.1, .a = 0.3 }; /**< Hilight colour */
/* objects */
-glColour cInert = { .r = 0.6, .g = 0.6, .b = 0.6, .a = 1. }; /**< Inert object colour */
-glColour cNeutral = { .r = 0.9, .g = 1.0, .b = 0.3, .a = 1. }; /**< Neutral object colour */
-glColour cMapNeutral = { .r = 0.3, .g = 0.3, .b = 0.3, .a = 1. }; /**< Neutral object map screen text colour */
-glColour cFriend = { .r = 0.0, .g = 0.8, .b = 0.0, .a = 1. }; /**< Friend object colour */
-glColour cHostile = { .r = 0.9, .g = 0.2, .b = 0.2, .a = 1. }; /**< Hostile object colour */
-glColour cRestricted = { .r = 1.0, .g = 0.6, .b = 0.0, .a = 1. }; /**< Restricted object colour. */
-glColour cDRestricted = { .r = 0.7, .g = 0.3, .b = 0.0, .a = 1. }; /**< Restricted object colour. Darkened for use on white. */
+const glColour cInert = { .r = 0.6, .g = 0.6, .b = 0.6, .a = 1. }; /**< Inert object colour */
+const glColour cNeutral = { .r = 0.9, .g = 1.0, .b = 0.3, .a = 1. }; /**< Neutral object colour */
+const glColour cMapNeutral = { .r = 0.3, .g = 0.3, .b = 0.3, .a = 1. }; /**< Neutral object map screen text colour */
+const glColour cFriend = { .r = 0.0, .g = 0.8, .b = 0.0, .a = 1. }; /**< Friend object colour */
+const glColour cHostile = { .r = 0.9, .g = 0.2, .b = 0.2, .a = 1. }; /**< Hostile object colour */
+const glColour cRestricted = { .r = 1.0, .g = 0.6, .b = 0.0, .a = 1. }; /**< Restricted object colour. */
+const glColour cDRestricted = { .r = 0.7, .g = 0.3, .b = 0.0, .a = 1. }; /**< Restricted object colour. Darkened for use on white. */
/* radar */
-glColour cRadar_player = { .r = 0.4, .g = 0.8, .b = 0.4, .a = 1. }; /**< Player colour on radar. */
-glColour cRadar_tPilot = { .r = 0.8, .g = 0.5, .b = 0.0, .a = 1. }; /**< Targeted object colour on radar. */
-glColour cRadar_tPlanet = { .r = 0.7, .g = 0.0, .b = 0.9, .a = 1. }; /**< Targeted planet colour. */
-glColour cRadar_weap = { .r = 0.8, .g = 0.2, .b = 0.2, .a = 1. }; /**< Weapon colour on radar. */
-glColour cRadar_hilight = { .r = 0.0, .g = 0.8, .b = 0.8, .a = 1. }; /**< Radar hilighted object. */
+const glColour cRadar_player = { .r = 0.4, .g = 0.8, .b = 0.4, .a = 1. }; /**< Player colour on radar. */
+const glColour cRadar_tPilot = { .r = 0.8, .g = 0.5, .b = 0.0, .a = 1. }; /**< Targeted object colour on radar. */
+const glColour cRadar_tPlanet = { .r = 0.7, .g = 0.0, .b = 0.9, .a = 1. }; /**< Targeted planet colour. */
+const glColour cRadar_weap = { .r = 0.8, .g = 0.2, .b = 0.2, .a = 1. }; /**< Weapon colour on radar. */
+const glColour cRadar_hilight = { .r = 0.0, .g = 0.8, .b = 0.8, .a = 1. }; /**< Radar hilighted object. */
/* health */
-glColour cShield = { .r = 0.2, .g = 0.2, .b = 0.8, .a = 1. }; /**< Shield bar colour. */
-glColour cArmour = { .r = 0.5, .g = 0.5, .b = 0.5, .a = 1. }; /**< Armour bar colour. */
-glColour cEnergy = { .r = 0.2, .g = 0.8, .b = 0.2, .a = 1. }; /**< Energy bar colour. */
-glColour cFuel = { .r = 0.9, .g = 0.1, .b = 0.4, .a = 1. }; /**< Fuel bar colour. */
+const glColour cShield = { .r = 0.2, .g = 0.2, .b = 0.8, .a = 1. }; /**< Shield bar colour. */
+const glColour cArmour = { .r = 0.5, .g = 0.5, .b = 0.5, .a = 1. }; /**< Armour bar colour. */
+const glColour cEnergy = { .r = 0.2, .g = 0.8, .b = 0.2, .a = 1. }; /**< Energy bar colour. */
+const glColour cFuel = { .r = 0.9, .g = 0.1, .b = 0.4, .a = 1. }; /**< Fuel bar colour. */
/* Deiz's Super Font Palette */
-glColour cFontRed = { .r = 0.8, .g = 0.2, .b = 0.2, .a = 1. }; /**< Red font colour. */
-glColour cFontGreen = { .r = 0.4, .g = 0.8, .b = 0.2, .a = 1. }; /**< Green font colour. */
-glColour cFontBlue = { .r = 0.2, .g = 0.4, .b = 0.8, .a = 1. }; /**< Blue font colour. */
-glColour cFontYellow = { .r = 0.9, .g = 0.8, .b = 0.0, .a = 1. }; /**< Yellow font colour. */
-glColour cFontWhite = { .r = 0.8, .g = 0.8, .b = 0.8, .a = 1. }; /**< White font colour. */
-glColour cFontPurple = { .r = 0.7, .g = 0.3, .b = 0.7, .a = 1. }; /**< Purple font colour. */
-glColour cFontFriendly = { .r = 0.3, .g = 0.9, .b = 0.3, .a = 1. }; /**< Friendly font colour. */
-glColour cFontHostile = { .r = 0.9, .g = 0.2, .b = 0.2, .a = 1. }; /**< Hostile font colour. */
-glColour cFontNeutral = { .r = 1.0, .g = 0.9, .b = 0.0, .a = 1. }; /**< Neutral font colour. */
+const glColour cFontRed = { .r = 0.8, .g = 0.2, .b = 0.2, .a = 1. }; /**< Red font colour. */
+const glColour cFontGreen = { .r = 0.4, .g = 0.8, .b = 0.2, .a = 1. }; /**< Green font colour. */
+const glColour cFontBlue = { .r = 0.2, .g = 0.4, .b = 0.8, .a = 1. }; /**< Blue font colour. */
+const glColour cFontYellow = { .r = 0.9, .g = 0.8, .b = 0.0, .a = 1. }; /**< Yellow font colour. */
+const glColour cFontWhite = { .r = 0.8, .g = 0.8, .b = 0.8, .a = 1. }; /**< White font colour. */
+const glColour cFontPurple = { .r = 0.7, .g = 0.3, .b = 0.7, .a = 1. }; /**< Purple font colour. */
+const glColour cFontFriendly = { .r = 0.3, .g = 0.9, .b = 0.3, .a = 1. }; /**< Friendly font colour. */
+const glColour cFontHostile = { .r = 0.9, .g = 0.2, .b = 0.2, .a = 1. }; /**< Hostile font colour. */
+const glColour cFontNeutral = { .r = 1.0, .g = 0.9, .b = 0.0, .a = 1. }; /**< Neutral font colour. */
/**
@@ -237,12 +237,12 @@ void col_rgb2hsv( double *H, double *S, double *V, double R, double G, double B
* @param bg Background colour.
* @param alpha Alpha value to use (0 to 1).
*/
-void col_blend( glColour *blend, glColour fg, glColour bg, double alpha )
+void col_blend( glColour *blend, const glColour *fg, const glColour *bg, double alpha )
{
- blend->r = (1. - alpha) * bg.r + alpha * fg.r;
- blend->g = (1. - alpha) * bg.g + alpha * fg.g;
- blend->b = (1. - alpha) * bg.b + alpha * fg.b;
- blend->a = (1. - alpha) * bg.a + alpha * fg.a;
+ blend->r = (1. - alpha) * bg->r + alpha * fg->r;
+ blend->g = (1. - alpha) * bg->g + alpha * fg->g;
+ blend->b = (1. - alpha) * bg->b + alpha * fg->b;
+ blend->a = (1. - alpha) * bg->a + alpha * fg->a;
}
@@ -254,7 +254,8 @@ void col_blend( glColour *blend, glColour fg, glColour bg, double alpha )
* @param name Colour's name
* @return the colour
*/
-glColour* col_fromName(const char* name) {
+const glColour* col_fromName( const char* name )
+{
if (name[0] == 'a' || name[0] == 'A') {
CHECK_COLOUR(Aqua);
}
View
@@ -25,86 +25,86 @@ typedef struct glColour_ {
* default colours
*/
/* greyscale */
-extern glColour cWhite;
+extern const glColour cWhite;
#define cGrey cGrey70
-extern glColour cBlack;
+extern const glColour cBlack;
/* greys */
-extern glColour cGrey90;
-extern glColour cGrey80;
-extern glColour cGrey70;
-extern glColour cGrey60;
-extern glColour cGrey50;
-extern glColour cGrey40;
-extern glColour cGrey30;
-extern glColour cGrey20;
-extern glColour cGrey10;
-
-extern glColour cGreen;
-extern glColour cDarkRed;
-extern glColour cRed;
-extern glColour cOrange;
-extern glColour cYellow;
-extern glColour cMidnightBlue;
-extern glColour cDarkBlue;
-extern glColour cBlue;
-extern glColour cLightBlue;
-extern glColour cPurple;
-extern glColour cDarkPurple;
-extern glColour cBrown;
-extern glColour cGold;
-extern glColour cSilver;
-extern glColour cAqua;
+extern const glColour cGrey90;
+extern const glColour cGrey80;
+extern const glColour cGrey70;
+extern const glColour cGrey60;
+extern const glColour cGrey50;
+extern const glColour cGrey40;
+extern const glColour cGrey30;
+extern const glColour cGrey20;
+extern const glColour cGrey10;
+
+extern const glColour cGreen;
+extern const glColour cDarkRed;
+extern const glColour cRed;
+extern const glColour cOrange;
+extern const glColour cYellow;
+extern const glColour cMidnightBlue;
+extern const glColour cDarkBlue;
+extern const glColour cBlue;
+extern const glColour cLightBlue;
+extern const glColour cPurple;
+extern const glColour cDarkPurple;
+extern const glColour cBrown;
+extern const glColour cGold;
+extern const glColour cSilver;
+extern const glColour cAqua;
/*
* game specific
*/
/*
* game specific
*/
-extern glColour cBlackHilight;
-extern glColour cConsole;
-extern glColour cDConsole;
+extern const glColour cBlackHilight;
+extern const glColour cConsole;
+extern const glColour cDConsole;
/* toolkit */
-extern glColour cHilight;
+extern const glColour cHilight;
/* objects */
-extern glColour cInert;
-extern glColour cNeutral;
-extern glColour cMapNeutral;
-extern glColour cFriend;
-extern glColour cHostile;
-extern glColour cRestricted;
-extern glColour cDRestricted;
+extern const glColour cInert;
+extern const glColour cNeutral;
+extern const glColour cMapNeutral;
+extern const glColour cFriend;
+extern const glColour cHostile;
+extern const glColour cRestricted;
+extern const glColour cDRestricted;
/* radar */
-extern glColour cRadar_player;
-extern glColour cRadar_tPilot;
-extern glColour cRadar_tPlanet;
-extern glColour cRadar_weap;
-extern glColour cRadar_hilight;
+extern const glColour cRadar_player;
+extern const glColour cRadar_tPilot;
+extern const glColour cRadar_tPlanet;
+extern const glColour cRadar_weap;
+extern const glColour cRadar_hilight;
/* health */
-extern glColour cShield;
-extern glColour cArmour;
-extern glColour cEnergy;
-extern glColour cFuel;
+extern const glColour cShield;
+extern const glColour cArmour;
+extern const glColour cEnergy;
+extern const glColour cFuel;
/* Deiz's Super Font Palette */
-extern glColour cFontRed;
-extern glColour cFontGreen;
-extern glColour cFontBlue;
-extern glColour cFontYellow;
-extern glColour cFontWhite;
-extern glColour cFontPurple;
-extern glColour cFontFriendly;
-extern glColour cFontHostile;
-extern glColour cFontNeutral;
+extern const glColour cFontRed;
+extern const glColour cFontGreen;
+extern const glColour cFontBlue;
+extern const glColour cFontYellow;
+extern const glColour cFontWhite;
+extern const glColour cFontPurple;
+extern const glColour cFontFriendly;
+extern const glColour cFontHostile;
+extern const glColour cFontNeutral;
-glColour* col_fromName( const char* name );
+const glColour* col_fromName( const char* name );
/*
* Colour space conversion routines.
*/
void col_hsv2rgb( double *r, double *g, double *b, double h, double s, double v );
void col_rgb2hsv( double *h, double *s, double *v, double r, double g, double b );
-void col_blend( glColour *out, glColour fg, glColour bg, double alpha );
+void col_blend( glColour *blend, const glColour *fg, const glColour *bg, double alpha );
View
@@ -281,7 +281,7 @@ static unsigned int comm_open( glTexture *gfx, int faction,
glTexture *logo;
char *stand;
unsigned int wid;
- glColour *c;
+ const glColour *c;
glFont *font;
int gw, gh;
double aspect;
View
@@ -216,7 +216,7 @@ static void cli_render( double bx, double by, double w, double h, void *data )
{
(void) data;
int i, y;
- glColour *c;
+ const glColour *c;
/* Draw the text. */
i = cli_viewport;
View
@@ -113,7 +113,7 @@ static void sysedit_buttonZoom( unsigned int wid, char* str );
static void sysedit_render( double bx, double by, double w, double h, void *data );
static void sysedit_renderBG( double bx, double bw, double w, double h, double x, double y);
static void sysedit_renderSprite( glTexture *gfx, double bx, double by, double x, double y,
- int sx, int sy, glColour *c, int selected, const char *caption );
+ int sx, int sy, const glColour *c, int selected, const char *caption );
static void sysedit_renderOverlay( double bx, double by, double bw, double bh, void* data );
static void sysedit_mouse( unsigned int wid, SDL_Event* event, double mx, double my,
double w, double h, void *data );
@@ -536,7 +536,7 @@ static void sysedit_render( double bx, double by, double w, double h, void *data
Planet *p;
JumpPoint *jp;
double x,y, z;
- glColour *c;
+ const glColour *c;
int selected;
Select_t sel;
@@ -648,10 +648,11 @@ static void sysedit_renderBG( double bx, double by, double w, double h, double x
* @brief Renders a sprite for the custom widget.
*/
static void sysedit_renderSprite( glTexture *gfx, double bx, double by, double x, double y,
- int sx, int sy, glColour *c, int selected, const char *caption )
+ int sx, int sy, const glColour *c, int selected, const char *caption )
{
double tx, ty, z;
- glColour cc, *col;
+ glColour cc;
+ const glColour *col;
/* Comfort. */
z = sysedit_zoom;
Oops, something went wrong.

0 comments on commit e9fa991

Please sign in to comment.