1 /* 2 * This file is part of Dune Legacy. 3 * 4 * Dune Legacy is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 2 of the License, or 7 * (at your option) any later version. 8 * 9 * Dune Legacy is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with Dune Legacy. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef COLORS_H 19 #define COLORS_H 20 21 #include <SDL.h> 22 23 #if SDL_BYTEORDER == SDL_BIG_ENDIAN 24 #define RMASK 0xFF000000U 25 #define GMASK 0x00FF0000U 26 #define BMASK 0x0000FF00U 27 #define AMASK 0x000000FFU 28 29 #define RSHIFT 24 30 #define GSHIFT 16 31 #define BSHIFT 8 32 #define ASHIFT 0 33 #else 34 #define RMASK 0x000000FFU 35 #define GMASK 0x0000FF00U 36 #define BMASK 0x00FF0000U 37 #define AMASK 0xFF000000U 38 39 #define RSHIFT 0 40 #define GSHIFT 8 41 #define BSHIFT 16 42 #define ASHIFT 24 43 #endif 44 45 #define COLOR_RGBA(r,g,b,a) ( ((((unsigned int) r) & 0xFF) << RSHIFT) | ((((unsigned int) g) & 0xFF) << GSHIFT) | ((((unsigned int) b) & 0xFF) << BSHIFT) | ((((unsigned int) a) & 0xFF) << ASHIFT) ) 46 #define COLOR_RGB(r,g,b) COLOR_RGBA(r,g,b,255) 47 #define MapRGBA(fmt, color) SDL_MapRGBA(fmt, (color & RMASK) >> RSHIFT, (color & GMASK) >> GSHIFT, (color & BMASK) >> BSHIFT, (color & AMASK) >> ASHIFT) 48 49 #define SDL2RGB(sdl_color) COLOR_RGB(sdl_color.r, sdl_color.g, sdl_color.b) 50 51 // Palette color indices 52 #define PALCOLOR_TRANSPARENT 0 53 #define PALCOLOR_BLACK 12 54 #define PALCOLOR_DARKGREY 13 55 #define PALCOLOR_BLUE 11 56 #define PALCOLOR_LIGHTBLUE 9 57 #define PALCOLOR_LIGHTGREY 14 58 #define PALCOLOR_BROWN 95 59 #define PALCOLOR_YELLOW 123 60 #define PALCOLOR_GREEN 3 61 #define PALCOLOR_LIGHTGREEN 4 62 #define PALCOLOR_RED 231 63 #define PALCOLOR_LIGHTRED 8 64 #define PALCOLOR_WHITE 15 65 #define PALCOLOR_ORANGE 83 66 #define PALCOLOR_GREY 133 67 #define PALCOLOR_WINDTRAP_COLORCYCLE 223 68 #define PALCOLOR_UI_COLORCYCLE 255 69 70 #define PALCOLOR_DESERTSAND 105 71 #define PALCOLOR_SPICE 111 72 #define PALCOLOR_THICKSPICE 116 73 #define PALCOLOR_MOUNTAIN 47 74 75 #define PALCOLOR_HARKONNEN 144 76 #define PALCOLOR_ATREIDES 160 77 #define PALCOLOR_ORDOS 176 78 #define PALCOLOR_FREMEN 192 79 #define PALCOLOR_SARDAUKAR 208 80 #define PALCOLOR_MERCENARY 224 81 82 // Colors 83 #define COLOR_INVALID COLOR_RGBA(0xDE, 0xAD, 0xBE, 0xEF) 84 #define COLOR_TRANSPARENT COLOR_RGBA(0,0,0,0) 85 #define COLOR_HALF_TRANSPARENT COLOR_RGBA(0,0,0,128) 86 #define COLOR_FOG_TRANSPARENT COLOR_RGBA(0,0,0,96) 87 #define COLOR_SHADOW_TRANSPARENT COLOR_RGBA(0,0,0,128) 88 #define COLOR_INDICATOR_TRANSPARENT COLOR_RGBA(255,255,255,48) 89 #define COLOR_BLACK COLOR_RGB(0,0,0) 90 #define COLOR_WHITE COLOR_RGB(255,255,255) 91 #define COLOR_DARKGREY COLOR_RGB(85,85,85) 92 #define COLOR_LIGHTGREY COLOR_RGB(170,170,170) 93 #define COLOR_LIGHTBLUE COLOR_RGB(85,255,255) 94 #define COLOR_RED COLOR_RGB(240,0,0) 95 #define COLOR_YELLOW COLOR_RGB(255,255,0) 96 #define COLOR_LIGHTYELLOW COLOR_RGB(255,182,44) 97 #define COLOR_LIGHTGREEN COLOR_RGB(85,255,85) 98 #define COLOR_GREEN COLOR_RGB(0,170,0) 99 #define COLOR_BLUE COLOR_RGB(0,0,170) 100 #define COLOR_ORANGE COLOR_RGB(255,68,0) 101 102 #define COLOR_DESERTSAND COLOR_RGB(255,210,125) 103 #define COLOR_SPICE COLOR_RGB(242,174,36) 104 #define COLOR_THICKSPICE COLOR_RGB(182,125,12) 105 #define COLOR_ROCK COLOR_DARKGREY 106 #define COLOR_MOUNTAIN COLOR_RGB(105,80,4) 107 #define COLOR_BLOOM COLOR_RED 108 109 #endif // COLORS_H 110