1 /* Sets the colour scheme
2  * Ben Lynn
3  */
4 /*
5 Copyright (C) 2004 Benjamin Lynn (blynn@cs.stanford.edu)
6 
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
11 
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 GNU General Public License for more details.
16 
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
20 */
21 #include "colour.h"
22 
23 SDL_Color rgbtable[c_max];
24 int ctable[c_max];
25 
init_rgb(int c,int r,int g,int b)26 void init_rgb(int c, int r, int g, int b)
27 {
28     rgbtable[c].r = r;
29     rgbtable[c].g = g;
30     rgbtable[c].b = b;
31 }
32 
init_rgbtable()33 void init_rgbtable()
34 {
35     init_rgb(c_background, 50, 150, 50);
36     init_rgb(c_menubg, 0, 50, 0);
37     init_rgb(c_shadow, 20, 100, 20);
38     init_rgb(c_darkshadow, 0, 0, 0);
39     /* border highlight for cell that the mouse is pointing at */
40     init_rgb(c_highlight, 180, 255, 180);
41     /* border highlight for cell on an opposite edge */
42     init_rgb(c_edgematch, 127, 127, 127);
43     init_rgb(c_text, 255, 255, 255);
44     init_rgb(c_invtext, 0, 0, 0);
45     init_rgb(c_canvas, 0, 0, 0);
46     init_rgb(c_buttonborder, 0, 127, 0);
47     init_rgb(c_server, 0, 0, 191);
48     init_rgb(c_serverwon, 0, 0, 255);
49     init_rgb(c_on, 0, 255, 0);
50     init_rgb(c_off, 127, 0, 0);
51     init_rgb(c_up, 0, 255, 255);
52     init_rgb(c_down, 127, 0, 127);
53     init_rgb(c_windowborder, 0, 255, 0);
54     init_rgb(c_pulse, 255, 255, 255);
55     init_rgb(c_borderwon, 0, 127, 127);
56     init_rgb(c_border, 0, 127, 0);
57     /* background color for unmarked tile */
58     init_rgb(c_unmarkedbg, 0, 0, 0);
59     /* background color for marked tile */
60     init_rgb(c_markedbg, 0, 0, 127);
61 }
62 
init_ctable(SDL_PixelFormat * format)63 void init_ctable(SDL_PixelFormat *format)
64 {
65     int i;
66     for (i=0; i<c_max; i++) {
67 	ctable[i] = SDL_MapRGB(format, rgbtable[i].r, rgbtable[i].g, rgbtable[i].b);
68     }
69 }
70