|
1 /* |
|
2 * LDForge: LDraw parts authoring CAD |
|
3 * Copyright (C) 2013 Santeri `arezey` Piippo |
|
4 * |
|
5 * This program is free software: you can redistribute it and/or modify |
|
6 * it under the terms of the GNU General Public License as published by |
|
7 * the Free Software Foundation, either version 3 of the License, or |
|
8 * (at your option) any later version. |
|
9 * |
|
10 * This program is distributed in the hope that it will be useful, |
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 * GNU General Public License for more details. |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License |
|
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
17 */ |
|
18 |
|
19 #include "common.h" |
|
20 #include "colors.h" |
|
21 |
|
22 // Placeholder static color table until I make an LDConfig.ldr parser |
|
23 static TemporaryColorMeta g_LDColorInfo[] = { |
|
24 {0, "Black", "#101010", 1.0}, |
|
25 {1, "Blue", "#0000FF", 1.0}, |
|
26 {2, "Green", "#008000", 1.0}, |
|
27 {3, "Teal", "#008080", 1.0}, |
|
28 {4, "Red", "#C00000", 1.0}, |
|
29 {5, "Dark pink", "#C00060", 1.0}, |
|
30 {6, "Brown", "#604000", 1.0}, |
|
31 {7, "Gray", "#989890", 1.0}, |
|
32 {8, "Dark Gray", "#6E6D62", 1.0}, |
|
33 {9, "Light Blue", "#60A0C0", 1.0}, |
|
34 {10, "Bright Green", "#40C040", 1.0}, |
|
35 {11, "Cyan", "#00FFFF", 1.0}, |
|
36 {12, "Salmon", "#FF8080", 1.0}, |
|
37 {13, "Pink", "#FF2080", 1.0}, |
|
38 {14, "Yellow", "#FFEE00", 1.0}, |
|
39 {15, "White", "#FFFFFF", 1.0}, |
|
40 {16, "Main Color", "#808080", 1.0}, |
|
41 {17, "Light Green", "#80FF80", 1.0}, |
|
42 {18, "Light Yellow", "#FFFF80", 1.0}, |
|
43 {19, "Tan", "#EECC99", 1.0}, |
|
44 {22, "Purple", "#A000A0", 1.0}, |
|
45 {24, "Edge Color", "#000000", 1.0}, |
|
46 {27, "Lime", "#00FF00", 1.0}, |
|
47 {28, "Sand", "#989070", 1.0}, |
|
48 {32, "Smoke", "#101010", 0.5}, |
|
49 {33, "Trans Blue", "#0000FF", 0.5}, |
|
50 {34, "Trans Green", "#008000", 0.5}, |
|
51 {35, "Trans Teal", "#008080", 0.5}, |
|
52 {36, "Trans Red", "#C00000", 0.5}, |
|
53 {37, "Trans Dk Pink", "#C00060", 0.5}, |
|
54 {38, "Trans Brown", "#604000", 0.5}, |
|
55 {39, "Trans Gray", "#989890", 0.5}, |
|
56 {40, "Trans Dk Gray", "#6E6D62", 0.5}, |
|
57 {41, "Trans Lt Blue", "#60A0C0", 0.5}, |
|
58 {42, "Trans Bt Green", "#40C040", 0.5}, |
|
59 {43, "Trans Cyan", "#00FFFF", 0.5}, |
|
60 {44, "Trans Salmon", "#FF8080", 0.5}, |
|
61 {45, "Trans Pink", "#FF2080", 0.5}, |
|
62 {46, "Trans Yellow", "#FFEE00", 0.5}, |
|
63 {47, "Clear", "#FFFFFF", 0.5}, |
|
64 }; |
|
65 |
|
66 color* g_LDColors[MAX_COLORS]; |
|
67 static bool g_bColorsInit = false; |
|
68 |
|
69 void initColors () { |
|
70 if (g_bColorsInit) |
|
71 return; |
|
72 |
|
73 memset (g_LDColors, 0, sizeof g_LDColors); |
|
74 for (ulong i = 0; i < sizeof g_LDColorInfo / sizeof *g_LDColorInfo; ++i) { |
|
75 color* col = new color; |
|
76 col->zColor = g_LDColorInfo[i].sColor; |
|
77 col->zName = g_LDColorInfo[i].sName; |
|
78 col->fAlpha = g_LDColorInfo[i].fAlpha; |
|
79 |
|
80 g_LDColors[g_LDColorInfo[i].dIndex] = col; |
|
81 } |
|
82 |
|
83 g_bColorsInit = true; |
|
84 } |