Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* Made all the colours constant as they should be.

  • Loading branch information...
commit e9fa99108f93e8e2ec6fbe20c79d690431b8a3be 1 parent 6b8705a
@bobbens bobbens authored
Showing with 239 additions and 224 deletions.
  1. +1 −1  src/background.c
  2. +1 −1  src/background.h
  3. +63 −62 src/colour.c
  4. +58 −58 src/colour.h
  5. +1 −1  src/comm.c
  6. +1 −1  src/console.c
  7. +5 −4 src/dev_sysedit.c
  8. +9 −6 src/equipment.c
  9. +3 −3 src/faction.c
  10. +2 −2 src/faction.h
  11. +8 −8 src/font.c
  12. +3 −3 src/font.h
  13. +16 −15 src/gui.c
  14. +1 −1  src/gui.h
  15. +1 −1  src/gui_omsg.c
  16. +1 −1  src/gui_osd.c
  17. +3 −2 src/land_outfits.c
  18. +1 −1  src/land_shipyard.c
  19. +3 −2 src/map.c
  20. +1 −1  src/nlua_col.c
  21. +1 −1  src/nlua_faction.c
  22. +1 −1  src/nlua_pilot.c
  23. +1 −1  src/nlua_planet.c
  24. +1 −1  src/outfit.c
  25. +1 −1  src/outfit.h
  26. +2 −2 src/pilot.c
  27. +1 −1  src/pilot.h
  28. +2 −2 src/space.c
  29. +1 −1  src/space.h
  30. +6 −6 src/tk/toolkit_priv.h
  31. +5 −5 src/tk/widget/button.c
  32. +4 −4 src/tk/widget/image.c
  33. +2 −2 src/tk/widget/image.h
  34. +2 −1  src/tk/widget/imagearray.c
  35. +9 −4 src/tk/widget/rect.c
  36. +3 −2 src/tk/widget/rect.h
  37. +1 −1  src/tk/widget/tabwin.c
  38. +4 −4 src/tk/widget/text.c
  39. +2 −2 src/tk/widget/text.h
  40. +7 −7 src/toolkit.c
  41. +1 −1  src/weapon.c
View
2  src/background.c
@@ -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
2  src/background.h
@@ -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
125 src/colour.c
@@ -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
116 src/colour.h
@@ -25,35 +25,35 @@ 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
@@ -61,42 +61,42 @@ extern glColour cAqua;
/*
* 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 );
/*
@@ -104,7 +104,7 @@ glColour* col_fromName( const char* name );
*/
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
2  src/comm.c
@@ -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
2  src/console.c
@@ -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
9 src/dev_sysedit.c
@@ -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;
View
15 src/equipment.c
@@ -334,7 +334,8 @@ static void equipment_renderColumn( double x, double y, double w, double h,
int selected, Outfit *o, Pilot *p, CstSlotWidget *wgt )
{
int i, level;
- glColour *c, *dc, bc;
+ const glColour *c, *dc;
+ glColour bc;
/* Render text. */
if ((o != NULL) && (lst[0].slot.type == o->slot.type))
@@ -505,7 +506,7 @@ static void equipment_renderMisc( double bx, double by, double bw, double bh, vo
double percent;
double x, y;
double w, h;
- glColour *lc, *c, *dc;
+ const glColour *lc, *c, *dc;
/* Must have selected ship. */
if (eq_wgt.selected == NULL)
@@ -554,7 +555,8 @@ static void equipment_renderOverlayColumn( double x, double y, double w, double
int n, PilotOutfitSlot *lst, int mover, CstSlotWidget *wgt )
{
int i;
- glColour *c, tc;
+ const glColour *c;
+ glColour tc;
int text_width, xoff, yoff, top;
const char *display;
int subtitle;
@@ -752,7 +754,7 @@ static void equipment_renderShip( double bx, double by,
double bw, double bh, double x, double y, Pilot* p )
{
int sx, sy;
- glColour *lc, *c, *dc;
+ const glColour *lc, *c, *dc;
unsigned int tick;
double dt;
double px, py;
@@ -1270,7 +1272,8 @@ static void equipment_genLists( unsigned int wid )
char **quantity;
Outfit *o;
Pilot *s;
- glColour *bg, *c, blend;
+ const glColour *c;
+ glColour *bg, blend;
char **slottype;
const char *typename;
@@ -1335,7 +1338,7 @@ static void equipment_genLists( unsigned int wid )
c = outfit_slotSizeColour( &o->slot );
if (c == NULL)
c = &cBlack;
- col_blend( &blend, *c, cGrey70, 0.4 );
+ col_blend( &blend, c, &cGrey70, 0.4 );
memcpy( &bg[i], &blend, sizeof(glColour) );
/* Short description. */
View
6 src/faction.c
@@ -63,7 +63,7 @@ typedef struct Faction_ {
/* Graphics. */
glTexture *logo_small; /**< Small logo. */
glTexture *logo_tiny; /**< Tiny logo. */
- glColour *colour; /**< Faction specific colour. */
+ const glColour *colour; /**< Faction specific colour. */
/* Enemies */
int *enemies; /**< Enemies by ID of the faction. */
@@ -257,7 +257,7 @@ glTexture* faction_logoTiny( int f )
* @param f Faction to get the colour of.
* @return The faction's colour
*/
-glColour* faction_colour( int f )
+const glColour* faction_colour( int f )
{
if (!faction_isFaction(f)) {
WARN("Faction id '%d' is invalid.",f);
@@ -559,7 +559,7 @@ double faction_getPlayerDef( int f )
* @param f Faction to get the colour of based on player's standing.
* @return Pointer to the colour.
*/
-glColour* faction_getColour( int f )
+const glColour* faction_getColour( int f )
{
if (f<0) return &cInert;
else if (areAllies(FACTION_PLAYER,f)) return &cFriend;
View
4 src/faction.h
@@ -26,7 +26,7 @@ lua_State *faction_getScheduler( int f );
lua_State *faction_getEquipper( int f );
glTexture* faction_logoSmall( int f );
glTexture* faction_logoTiny( int f );
-glColour* faction_colour( int f );
+const glColour* faction_colour( int f );
int* faction_getEnemies( int f, int *n );
int* faction_getAllies( int f, int *n );
int* faction_getGroup( int *n, int which );
@@ -39,7 +39,7 @@ double faction_getPlayer( int f );
double faction_getPlayerDef( int f );
char* faction_getStanding( double mod );
char *faction_getStandingBroad( double mod );
-glColour* faction_getColour( int f );
+const glColour* faction_getColour( int f );
char faction_getColourChar( int f );
/* works with only factions */
View
16 src/font.c
@@ -58,7 +58,7 @@ glFont gl_smallFont; /**< Small font. */
/* Last used colour. */
-static glColour *font_lastCol = NULL; /**< Stores last colour used (activated by '\e'). */
+static const glColour *font_lastCol = NULL; /**< Stores last colour used (activated by '\e'). */
static int font_restoreLast = 0; /**< Restore last colour. */
@@ -67,7 +67,7 @@ static int font_restoreLast = 0; /**< Restore last colour. */
*/
static int font_limitSize( const glFont *ft_font, int *width,
const char *text, const int max );
-static glColour* gl_fontGetColour( int ch );
+static const glColour* gl_fontGetColour( int ch );
/* Render. */
static void gl_fontRenderStart( const glFont* font, double x, double y, const glColour *c );
static int gl_fontRenderCharacter( const glFont* font, int ch, const glColour *c, int state );
@@ -116,7 +116,7 @@ void gl_printRestore( const glFontRestore *restore )
void gl_printStoreMax( glFontRestore *restore, const char *text, int max )
{
int i;
- glColour *col;
+ const glColour *col;
col = NULL;
for (i=0; (text[i]!='\0') && (i<=max); i++) {
@@ -459,7 +459,7 @@ int gl_printMid( const glFont *ft_font, const int width,
int gl_printTextRaw( const glFont *ft_font,
const int width, const int height,
double bx, double by,
- glColour* c, const char *text )
+ const glColour* c, const char *text )
{
int ret, i, p, s;
double x,y;
@@ -516,7 +516,7 @@ int gl_printTextRaw( const glFont *ft_font,
int gl_printText( const glFont *ft_font,
const int width, const int height,
double bx, double by,
- glColour* c, const char *fmt, ... )
+ const glColour* c, const char *fmt, ... )
{
/*float h = ft_font->h / .63;*/ /* slightly increase fontsize */
char text[4096]; /* holds the string */
@@ -927,9 +927,9 @@ static void gl_fontRenderStart( const glFont* font, double x, double y, const gl
/**
* @brief Gets the colour from a character.
*/
-static glColour* gl_fontGetColour( int ch )
+static const glColour* gl_fontGetColour( int ch )
{
- glColour *col;
+ const glColour *col;
switch (ch) {
/* TOP SECRET COLOUR CONVENTION
* FOR YOUR EYES ONLY
@@ -970,7 +970,7 @@ static int gl_fontRenderCharacter( const glFont* font, int ch, const glColour *c
{
GLushort ind[6];
double a;
- glColour *col;
+ const glColour *col;
/* Handle escape sequences. */
if (ch == '\e') /* Start sequence. */
View
6 src/font.h
@@ -38,7 +38,7 @@ extern glFont gl_smallFont; /**< small font */
* @brief Evil hack to allow restoring, yes it makes me cry myself to sleep.
*/
typedef struct glFontRestore_s {
- glColour *col; /**< Colour to restore. */
+ const glColour *col; /**< Colour to restore. */
} glFontRestore;
@@ -66,7 +66,7 @@ int gl_printMidRaw( const glFont *ft_font, const int width,
int gl_printTextRaw( const glFont *ft_font,
const int width, const int height,
double bx, double by,
- glColour* c, const char *text );
+ const glColour* c, const char *text );
/*
@@ -87,7 +87,7 @@ int gl_printMid( const glFont *ft_font, const int width,
int gl_printText( const glFont *ft_font,
const int width, const int height,
double bx, double by,
- glColour* c, const char *fmt, ... );
+ const glColour* c, const char *fmt, ... );
/* Dimension stuff. */
View
31 src/gui.c
@@ -193,10 +193,10 @@ static void gui_renderPilotTarget( double dt );
static void gui_renderPlanetTarget( double dt );
static void gui_renderBorder( double dt );
static void gui_renderMessages( double dt );
-static glColour *gui_getPlanetColour( int i );
-static void gui_renderRadarOutOfRange( RadarShape sh, int w, int h, int cx, int cy, glColour *col );
+static const glColour *gui_getPlanetColour( int i );
+static void gui_renderRadarOutOfRange( RadarShape sh, int w, int h, int cx, int cy, const glColour *col );
static void gui_planetBlink( int w, int h, int rc, int cx, int cy, GLfloat vr, RadarShape shape );
-static glColour* gui_getPilotColour( const Pilot* p );
+static const glColour* gui_getPilotColour( const Pilot* p );
static void gui_renderInterference (void);
static void gui_calcBorders (void);
/* Lua GUI. */
@@ -391,7 +391,7 @@ static void gui_renderPlanetTarget( double dt )
{
(void) dt;
double x,y, w,h;
- glColour *c;
+ const glColour *c;
Planet *planet;
JumpPoint *jp;
@@ -446,7 +446,7 @@ static void gui_renderPlanetTarget( double dt )
* @param h Height.
* @param c Colour.
*/
-void gui_renderTargetReticles( int x, int y, int w, int h, glColour* c )
+void gui_renderTargetReticles( int x, int y, int w, int h, const glColour* c )
{
/* Must not be NULL. */
if (gui_target_planet == NULL)
@@ -474,7 +474,7 @@ static void gui_renderPilotTarget( double dt )
{
(void) dt;
Pilot *p;
- glColour *c;
+ const glColour *c;
double x, y;
/* Player is most likely dead. */
@@ -592,7 +592,7 @@ static void gui_renderBorder( double dt )
int hw, hh;
double rx,ry;
double cx,cy;
- glColour *col;
+ const glColour *col;
double int_a;
GLfloat vertex[5*2], colours[5*4];
@@ -1206,9 +1206,9 @@ static void gui_renderInterference (void)
*
* @sa pilot_getColour
*/
-static glColour* gui_getPilotColour( const Pilot* p )
+static const glColour* gui_getPilotColour( const Pilot* p )
{
- glColour *col;
+ const glColour *col;
if (p->id == player.p->target)
col = &cRadar_tPilot;
@@ -1232,7 +1232,8 @@ void gui_renderPilot( const Pilot* p, RadarShape shape, double w, double h, doub
int i, curs;
int x, y, sx, sy;
double px, py;
- glColour *col, ccol;
+ const glColour *col;
+ glColour ccol;
GLfloat vertex[2*8], colours[4*8];
GLfloat cx, cy;
int rc;
@@ -1383,9 +1384,9 @@ void gui_renderPlayer( double res, int overlay )
* @param i Index of the planet to get colour of.
* @return Colour of the planet.
*/
-static glColour *gui_getPlanetColour( int i )
+static const glColour *gui_getPlanetColour( int i )
{
- glColour *col;
+ const glColour *col;
Planet *planet;
planet = cur_system->planets[i];
@@ -1474,7 +1475,7 @@ static void gui_planetBlink( int w, int h, int rc, int cx, int cy, GLfloat vr, R
/**
* @brief Renders an out of range marker for the planet.
*/
-static void gui_renderRadarOutOfRange( RadarShape sh, int w, int h, int cx, int cy, glColour *col )
+static void gui_renderRadarOutOfRange( RadarShape sh, int w, int h, int cx, int cy, const glColour *col )
{
GLfloat vertex[2*2], colours[8*2];
double a;
@@ -1545,7 +1546,7 @@ void gui_renderPlanet( int ind, RadarShape shape, double w, double h, double res
int cx, cy, r, rc;
GLfloat vx, vy, vr;
GLfloat a;
- glColour *col;
+ const glColour *col;
Planet *planet;
GLfloat vertex[5*2], colours[5*4];
@@ -1649,7 +1650,7 @@ void gui_renderJumpPoint( int ind, RadarShape shape, double w, double h, double
GLfloat a;
GLfloat ca, sa;
GLfloat vx, vy, vr;
- glColour *col;
+ const glColour *col;
GLfloat vertex[4*2], colours[4*4];
JumpPoint *jp;
View
2  src/gui.h
@@ -47,7 +47,7 @@ void gui_setGeneric ( Pilot* pilot );
*/
void gui_renderReticles( double dt );
void gui_render( double dt );
-void gui_renderTargetReticles( int x, int y, int w, int h, glColour* c );
+void gui_renderTargetReticles( int x, int y, int w, int h, const glColour* c );
void gui_forceBlink (void);
/*
View
2  src/gui_omsg.c
@@ -35,7 +35,7 @@ typedef struct omsg_s {
int nlines; /**< Message lines. */
double duration; /**< Time left. */
int font; /**< Font to use. */
- glColour *col; /**< Colour to use. */
+ const glColour *col; /**< Colour to use. */
} omsg_t;
static omsg_t *omsg_array = NULL; /**< Array of messages. */
static unsigned int omsg_idgen = 0; /**< Unique ID generator. */
View
2  src/gui_osd.c
@@ -347,7 +347,7 @@ void osd_render (void)
double p;
int i, j, l;
int w, x;
- glColour *c;
+ const glColour *c;
/* Nothing to render. */
if (osd_list == NULL)
View
5 src/land_outfits.c
@@ -80,7 +80,8 @@ void outfits_open( unsigned int wid )
int w, h;
int iw, ih;
int bw, bh;
- glColour *bg, *c, blend;
+ glColour *bg, blend;
+ const glColour *c;
char **slottype;
const char *slotname;
@@ -156,7 +157,7 @@ void outfits_open( unsigned int wid )
c = outfit_slotSizeColour( &outfits[i]->slot );
if (c == NULL)
c = &cBlack;
- col_blend( &blend, *c, cGrey70, 0.4 );
+ col_blend( &blend, c, &cGrey70, 0.4 );
memcpy( &bg[i], &blend, sizeof(glColour) );
/* Get slot name. */
View
2  src/land_shipyard.c
@@ -512,7 +512,7 @@ static void shipyard_renderSlotsRow( double bx, double by, double bw, char *str,
(void) bw;
int i;
double x;
- glColour *c;
+ const glColour *c;
x = bx;
View
5 src/map.c
@@ -731,7 +731,8 @@ void map_renderSystems( double bx, double by, double x, double y,
double w, double h, double r, int editor)
{
int i, j, k;
- glColour *col, c, *cole;
+ const glColour *col, *cole;
+ glColour c;
GLfloat vertex[8*(2+4)];
StarSystem *sys, *jsys;
int sw, sh;
@@ -850,7 +851,7 @@ void map_renderSystems( double bx, double by, double x, double y,
static void map_renderPath( double x, double y )
{
int j;
- glColour *col;
+ const glColour *col;
GLfloat vertex[8*(2+4)];
StarSystem *jsys, *lsys;
double fuel;
View
2  src/nlua_col.c
@@ -185,7 +185,7 @@ static int colL_eq( lua_State *L )
*/
static int colL_new( lua_State *L )
{
- glColour *col;
+ const glColour *col;
LuaColour lc, *lc2;
if (lua_gettop(L)==0) {
View
2  src/nlua_faction.c
@@ -523,7 +523,7 @@ static int factionL_colour( lua_State *L )
{
int lf;
LuaColour lc;
- glColour *col;
+ const glColour *col;
lf = luaL_validfaction(L,1);
col = faction_getColour(lf);
if (col == NULL)
View
2  src/nlua_pilot.c
@@ -2872,7 +2872,7 @@ static int pilotL_cargoList( lua_State *L )
static int pilotL_getColour( lua_State *L )
{
Pilot *p;
- glColour *col;
+ const glColour *col;
LuaColour lc;
/* Get the pilot. */
View
2  src/nlua_planet.c
@@ -510,7 +510,7 @@ static int planetL_faction( lua_State *L )
static int planetL_colour( lua_State *L )
{
Planet *p;
- glColour *col;
+ const glColour *col;
LuaColour lc;
p = luaL_validplanet(L,1);
View
2  src/outfit.c
@@ -281,7 +281,7 @@ const char *outfit_slotSize( const Outfit* o )
* @param os Outfit slot to get the slot size colour of.
* @return The slot size colour of the outfit slot.
*/
-glColour *outfit_slotSizeColour( const OutfitSlot* os )
+const glColour *outfit_slotSizeColour( const OutfitSlot* os )
{
if (os->size == OUTFIT_SLOT_SIZE_HEAVY)
return &cFontBlue;
View
2  src/outfit.h
@@ -365,7 +365,7 @@ char **outfit_searchFuzzyCase( const char* name, int *n );
*/
const char *outfit_slotName( const Outfit* o );
const char *outfit_slotSize( const Outfit* o );
-glColour *outfit_slotSizeColour( const OutfitSlot* os );
+const glColour *outfit_slotSizeColour( const OutfitSlot* os );
OutfitSlotSize outfit_toSlotSize( const char *s );
glTexture* outfit_gfx( const Outfit* o );
int outfit_spfxArmour( const Outfit* o );
View
4 src/pilot.c
@@ -863,9 +863,9 @@ int pilot_getJumps( const Pilot* p )
* @param p Pilot to get colour of.
* @return The colour of the pilot.
*/
-glColour* pilot_getColour( const Pilot* p )
+const glColour* pilot_getColour( const Pilot* p )
{
- glColour *col;
+ const glColour *col;
if (pilot_inRangePilot(player.p, p) == -1) col = &cMapNeutral;
else if (pilot_isDisabled(p) || pilot_isFlag(p,PILOT_DEAD)) col = &cInert;
View
2  src/pilot.h
@@ -417,7 +417,7 @@ unsigned int pilot_getNearestPilot( const Pilot* p );
double pilot_getNearestPos( const Pilot *p, unsigned int *tp, double x, double y, int disabled );
double pilot_getNearestAng( const Pilot *p, unsigned int *tp, double ang, int disabled );
int pilot_getJumps( const Pilot* p );
-glColour* pilot_getColour( const Pilot* p );
+const glColour* pilot_getColour( const Pilot* p );
/* non-lua wrappers */
double pilot_relsize( const Pilot* cur_pilot, const Pilot* p );
View
4 src/space.c
@@ -1496,7 +1496,7 @@ char planet_getColourChar( Planet *p )
/**
* @brief Gets the planet colour.
*/
-glColour* planet_getColour( Planet *p )
+const glColour* planet_getColour( Planet *p )
{
if (!planet_hasService( p, PLANET_SERVICE_INHABITED ))
return &cInert;
@@ -2704,7 +2704,7 @@ void planets_render (void)
*/
static void space_renderJumpPoint( JumpPoint *jp, int i )
{
- glColour *c;
+ const glColour *c;
if (jp_isFlag( jp, JP_HIDDEN ) || jp_isFlag( jp, JP_EXITONLY ))
return;
View
2  src/space.h
@@ -300,7 +300,7 @@ PlanetClass planetclass_get( const char a );
credits_t planet_commodityPrice( const Planet *p, const Commodity *c );
/* Land related stuff. */
char planet_getColourChar( Planet *p );
-glColour* planet_getColour( Planet *p );
+const glColour* planet_getColour( Planet *p );
void planet_updateLand( Planet *p );
/*
View
12 src/tk/toolkit_priv.h
@@ -17,9 +17,9 @@
/*
* Colours to use.
*/
-extern glColour* toolkit_colLight;
-extern glColour* toolkit_col;
-extern glColour* toolkit_colDark;
+extern const glColour* toolkit_colLight;
+extern const glColour* toolkit_col;
+extern const glColour* toolkit_colDark;
/**
@@ -189,12 +189,12 @@ void toolkit_prevFocus( Window *wdw );
/* Render stuff. */
void toolkit_drawOutline( int x, int y, int w, int h, int b,
- glColour* c, glColour* lc );
+ const glColour* c, const glColour* lc );
void toolkit_drawOutlineThick( int x, int y, int w, int h, int b,
- int thick, glColour* c, glColour* lc );
+ int thick, const glColour* c, const glColour* lc );
void toolkit_drawScrollbar( int x, int y, int w, int h, double pos );
void toolkit_drawRect( int x, int y, int w, int h,
- glColour* c, glColour* lc );
+ const glColour* c, const glColour* lc );
void toolkit_drawAltText( int bx, int by, const char *alt );
View
10 src/tk/widget/button.c
@@ -200,7 +200,7 @@ static int btn_key( Widget* btn, SDLKey key, SDLMod mod )
*/
static void btn_render( Widget* btn, double bx, double by )
{
- glColour *c, *dc, *lc;
+ const glColour *c, *dc, *lc;
double x, y;
x = bx + btn->x;
@@ -209,25 +209,25 @@ static void btn_render( Widget* btn, double bx, double by )
/* set the colours */
if (btn->dat.btn.disabled==1) {
lc = &cGrey60;
- c = &cGrey20;
+ c = &cGrey20;
dc = &cGrey40;
}
else {
switch (btn->status) {
case WIDGET_STATUS_MOUSEOVER:
lc = &cGrey90;
- c = &cGrey70;
+ c = &cGrey70;
dc = &cGrey50;
break;
case WIDGET_STATUS_MOUSEDOWN:
lc = &cGrey90;
- c = &cGrey50;
+ c = &cGrey50;
dc = &cGrey70;
break;
case WIDGET_STATUS_NORMAL:
default:
lc = &cGrey80;
- c = &cGrey60;
+ c = &cGrey60;
dc = &cGrey40;
break;
}
View
8 src/tk/widget/image.c
@@ -45,7 +45,7 @@ void window_addImage( const unsigned int wid,
wgt->render = img_render;
wgt->dat.img.image = image;
wgt->dat.img.border = border;
- wgt->dat.img.colour = NULL; /* normal colour */
+ wgt->dat.img.colour = cWhite; /* normal colour */
/* position/size */
wgt->w = (w > 0) ? w : ((image==NULL) ? 0 : wgt->dat.img.image->sw);
@@ -80,7 +80,7 @@ static void img_render( Widget* img, double bx, double by )
* image
*/
gl_blitScale( img->dat.img.image, x, y,
- w, h, img->dat.img.colour );
+ w, h, &img->dat.img.colour );
if (img->dat.img.border) {
/* inner outline (outwards) */
@@ -163,7 +163,7 @@ void window_modifyImage( const unsigned int wid,
* @param colour New colour to use.
*/
void window_imgColour( const unsigned int wid,
- char* name, glColour* colour )
+ char* name, const glColour* colour )
{
Widget *wgt;
@@ -179,6 +179,6 @@ void window_imgColour( const unsigned int wid,
}
/* Set the colour. */
- wgt->dat.img.colour = colour;
+ wgt->dat.img.colour = *colour;
}
View
4 src/tk/widget/image.h
@@ -17,7 +17,7 @@
*/
typedef struct WidgetImageData_{
glTexture* image; /**< Image to display. */
- glColour* colour; /**< Colour to warp to. */
+ glColour colour; /**< Colour to warp to. */
int border; /**< 1 if widget should have border. */
} WidgetImageData;
@@ -32,7 +32,7 @@ void window_addImage( const unsigned int wid,
void window_modifyImage( const unsigned int wid,
char* name, glTexture* image, int w, int h );
void window_imgColour( const unsigned int wid,
- char* name, glColour* colour );
+ char* name, const glColour* colour );
glTexture* window_getImage( const unsigned int wid, char* name );
View
3  src/tk/widget/imagearray.c
@@ -131,7 +131,8 @@ static void iar_render( Widget* iar, double bx, double by )
double scroll_pos;
int xelem, yelem;
double xspace;
- glColour *c, *dc, *lc, tc, fontcolour;
+ const glColour *c, *dc, *lc;
+ glColour tc, fontcolour;
int is_selected;
int tw;
double d;
View
13 src/tk/widget/rect.c
@@ -33,7 +33,7 @@ static void rct_render( Widget* rct, double bx, double by );
void window_addRect( const unsigned int wid,
const int x, const int y, /* position */
const int w, const int h, /* size */
- char* name, glColour* colour, int border )
+ char* name, const glColour* colour, int border )
{
Window *wdw = window_wget(wid);
Widget *wgt = window_newWidget(wdw, name);
@@ -45,7 +45,12 @@ void window_addRect( const unsigned int wid,
/* specific */
wgt->render = rct_render;
- wgt->dat.rct.colour = colour;
+ if (colour != NULL) {
+ wgt->dat.rct.colour = *colour;
+ wgt->dat.rct.fill = 1;
+ }
+ else
+ wgt->dat.rct.fill = 0;
wgt->dat.rct.border = border;
/* position/size */
@@ -69,8 +74,8 @@ static void rct_render( Widget* rct, double bx, double by )
x = bx + rct->x;
y = by + rct->y;
- if (rct->dat.rct.colour) /* draw rect only if it exists */
- toolkit_drawRect( x, y, rct->w, rct->h, rct->dat.rct.colour, NULL );
+ if (rct->dat.rct.fill) /* draw rect only if it exists */
+ toolkit_drawRect( x, y, rct->w, rct->h, &rct->dat.rct.colour, NULL );
if (rct->dat.rct.border) {
/* inner outline */
View
5 src/tk/widget/rect.h
@@ -15,7 +15,8 @@
* @brief The rectangle widget data.
*/
typedef struct WidgetRectData_{
- glColour* colour; /**< Background colour. */
+ glColour colour; /**< Background colour. */
+ int fill; /**< Whether or not rectangle is filled. */
int border; /**< 1 if widget should have border, 0 if it shouldn't. */
} WidgetRectData;
@@ -24,7 +25,7 @@ typedef struct WidgetRectData_{
void window_addRect( const unsigned int wid,
const int x, const int y, /* position */
const int w, const int h, /* size */
- char* name, glColour* colour, int border ); /* properties */
+ char* name, const glColour* colour, int border ); /* properties */
#endif /* WGT_RECT_H */
View
2  src/tk/widget/tabwin.c
@@ -281,7 +281,7 @@ static void tab_render( Widget* tab, double bx, double by )
{
int i, x;
Window *wdw;
- glColour *c, *lc;
+ const glColour *c, *lc;
/** Get window. */
wdw = window_wget( tab->dat.tab.windows[ tab->dat.tab.active ] );
View
8 src/tk/widget/text.c
@@ -40,7 +40,7 @@ void window_addText( const unsigned int wid,
const int x, const int y,
const int w, const int h,
const int centered, const char* name,
- glFont* font, glColour* colour, const char* string )
+ glFont* font, const glColour* colour, const char* string )
{
Window *wdw = window_wget(wid);
Widget *wgt = window_newWidget(wdw, name);
@@ -54,7 +54,7 @@ void window_addText( const unsigned int wid,
wgt->render = txt_render;
wgt->cleanup = txt_cleanup;
wgt->dat.txt.font = (font==NULL) ? &gl_defFont : font;
- wgt->dat.txt.colour = (colour==NULL) ? &cBlack : colour;
+ wgt->dat.txt.colour = (colour==NULL) ? cBlack : *colour;
wgt->dat.txt.centered = centered;
wgt->dat.txt.text = (string==NULL) ? NULL : strdup(string);
@@ -82,11 +82,11 @@ static void txt_render( Widget* txt, double bx, double by )
gl_printMidRaw( txt->dat.txt.font, txt->w,
bx + txt->x,
by + txt->y + (txt->h - txt->dat.txt.font->h)/2.,
- txt->dat.txt.colour, txt->dat.txt.text );
+ &txt->dat.txt.colour, txt->dat.txt.text );
else
gl_printTextRaw( txt->dat.txt.font, txt->w, txt->h,
bx + txt->x, by + txt->y,
- txt->dat.txt.colour, txt->dat.txt.text );
+ &txt->dat.txt.colour, txt->dat.txt.text );
}
View
4 src/tk/widget/text.h
@@ -17,7 +17,7 @@
typedef struct WidgetTextData_ {
char *text; /**< Text to display, using printMid if centered, else printText. */
glFont* font; /**< Text font. */
- glColour* colour; /**< Text colour. */
+ glColour colour; /**< Text colour. */
int centered; /**< 1 if text is centered, 0 if it isn't. */
} WidgetTextData;
@@ -27,7 +27,7 @@ void window_addText( const unsigned int wid,
const int x, const int y, /* position */
const int w, const int h, /* size */
const int centered, const char* name, /* text is centered? label name */
- glFont* font, glColour* colour, const char* string ); /* font, colour and actual text */
+ glFont* font, const glColour* colour, const char* string ); /* font, colour and actual text */
/* Misc functions. */
void window_modifyText( const unsigned int wid,
View
14 src/toolkit.c
@@ -57,9 +57,9 @@ static char input_text = 0; /**< Current character. */
/*
* default outline colours
*/
-glColour* toolkit_colLight = &cGrey90; /**< Light outline colour. */
-glColour* toolkit_col = &cGrey70; /**< Normal outline colour. */
-glColour* toolkit_colDark = &cGrey30; /**< Dark outline colour. */
+const glColour* toolkit_colLight = &cGrey90; /**< Light outline colour. */
+const glColour* toolkit_col = &cGrey70; /**< Normal outline colour. */
+const glColour* toolkit_colDark = &cGrey30; /**< Dark outline colour. */
/*
@@ -849,7 +849,7 @@ static void widget_kill( Widget *wgt )
* @param lc Light colour.
*/
void toolkit_drawOutlineThick( int x, int y, int w, int h, int b,
- int thick, glColour* c, glColour* lc )
+ int thick, const glColour* c, const glColour* lc )
{
GLshort tri[5][4];
glColour colours[10];
@@ -934,7 +934,7 @@ void toolkit_drawOutlineThick( int x, int y, int w, int h, int b,
* @param lc Light colour.
*/
void toolkit_drawOutline( int x, int y, int w, int h, int b,
- glColour* c, glColour* lc )
+ const glColour* c, const glColour* lc )
{
GLshort lines[4][2];
glColour colours[4];
@@ -991,7 +991,7 @@ void toolkit_drawOutline( int x, int y, int w, int h, int b,
* @param lc Light colour.
*/
void toolkit_drawRect( int x, int y, int w, int h,
- glColour* c, glColour* lc )
+ const glColour* c, const glColour* lc )
{
GLshort vertex[4][2];
glColour colours[4];
@@ -1090,7 +1090,7 @@ static void window_renderBorder( Window* w )
int i;
GLshort cx, cy;
double x, y;
- glColour *lc, *c, *dc, *oc;
+ const glColour *lc, *c, *dc, *oc;
GLshort vertex[31*4];
GLfloat colours[31*4];
View
2  src/weapon.c
@@ -162,7 +162,7 @@ void weapon_minimap( const double res, const double w,
int i, rc, p;
double x, y;
Weapon *wp;
- glColour *c;
+ const glColour *c;
GLsizei offset;
Pilot *par;
Please sign in to comment.
Something went wrong with that request. Please try again.