1 /* 2 C-Dogs SDL 3 A port of the legendary (and fun) action/arcade cdogs. 4 5 Copyright (c) 2013-2017 Cong Xu 6 All rights reserved. 7 8 Redistribution and use in source and binary forms, with or without 9 modification, are permitted provided that the following conditions are met: 10 11 Redistributions of source code must retain the above copyright notice, this 12 list of conditions and the following disclaimer. 13 Redistributions in binary form must reproduce the above copyright notice, 14 this list of conditions and the following disclaimer in the documentation 15 and/or other materials provided with the distribution. 16 17 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 18 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 POSSIBILITY OF SUCH DAMAGE. 28 */ 29 #pragma once 30 31 #include "sys_specifics.h" 32 33 #include <stdbool.h> 34 #include <stdint.h> 35 36 typedef struct 37 { 38 uint8_t r; 39 uint8_t g; 40 uint8_t b; 41 uint8_t a; 42 } color_t; 43 extern color_t colorWhite; 44 extern color_t colorRed; 45 extern color_t colorGreen; 46 extern color_t colorBlue; 47 extern color_t colorPoison; 48 extern color_t colorBlack; 49 extern color_t colorDarker; 50 extern color_t colorPurple; 51 extern color_t colorGray; 52 extern color_t colorYellow; 53 extern color_t colorMagenta; 54 extern color_t colorCyan; 55 extern color_t colorFog; 56 extern color_t colorOrange; 57 extern color_t colorTransparent; 58 59 extern color_t colorMaroon; 60 extern color_t colorLonestar; 61 extern color_t colorRusticRed; 62 extern color_t colorOfficeGreen; 63 extern color_t colorPakistanGreen; 64 extern color_t colorDarkFern; 65 extern color_t colorNavyBlue; 66 extern color_t colorArapawa; 67 extern color_t colorStratos; 68 extern color_t colorPatriarch; 69 extern color_t colorPompadour; 70 extern color_t colorLoulou; 71 extern color_t colorBattleshipGrey; 72 extern color_t colorDoveGray; 73 extern color_t colorGravel; 74 extern color_t colorComet; 75 extern color_t colorFiord; 76 extern color_t colorTuna; 77 extern color_t colorHacienda; 78 extern color_t colorKumera; 79 extern color_t colorHimalaya; 80 extern color_t colorChocolate; 81 extern color_t colorNutmeg; 82 extern color_t colorBracken; 83 extern color_t colorTeal; 84 extern color_t colorSkobeloff; 85 extern color_t colorDeepJungleGreen; 86 87 extern color_t colorSkin; 88 extern color_t colorDarkSkin; 89 extern color_t colorAsianSkin; 90 91 extern color_t colorLightBlue; 92 93 color_t ColorMult(color_t c, color_t m); 94 color_t ColorAlphaBlend(color_t a, color_t b); 95 96 typedef struct 97 { 98 double h, s, v; 99 } HSV; 100 extern HSV tintNone; 101 extern HSV tintRed; 102 extern HSV tintYellow; 103 extern HSV tintGreen; 104 extern HSV tintCyan; 105 extern HSV tintPoison; 106 extern HSV tintGray; 107 extern HSV tintPurple; 108 extern HSV tintDarker; 109 // Multiply by HSV components; used for tinting 110 // h: hue, if >= 0 then the hue is forced to be this value 111 // s: saturation, where all RGB components are shifted towards the average value 112 // v: scale factor on the final components 113 color_t ColorTint(color_t c, HSV hsv); 114 115 bool ColorEquals(const color_t a, const color_t b); 116 bool HSVEquals(const HSV a, const HSV b); 117 118 // Convert hex string to color 119 color_t StrColor(const char *s); 120 // Convert colour to hex string 121 void ColorStr(char *s, const color_t c); 122 #define COLOR_STR_BUF 9 123