brewpanel/sdlgui.c

changeset 427
e8e548922e31
parent 425
c51265b518ce
child 428
d64c4c1edd78
equal deleted inserted replaced
426:e54611453d29 427:e8e548922e31
36 static SDL_Surface *pFontGfx = NULL; /* The LCD font graphics */ 36 static SDL_Surface *pFontGfx = NULL; /* The LCD font graphics */
37 static SDL_Surface *pBgSurface; /* Pointer to the application SDL screen surface */ 37 static SDL_Surface *pBgSurface; /* Pointer to the application SDL screen surface */
38 static SDL_Rect dlgrect, bgrect; 38 static SDL_Rect dlgrect, bgrect;
39 static int fontwidth, fontheight; /* Width & height of the actual font */ 39 static int fontwidth, fontheight; /* Width & height of the actual font */
40 TTF_Font *pFont = NULL; /* TTF font for buttons etc. */ 40 TTF_Font *pFont = NULL; /* TTF font for buttons etc. */
41 static Uint32 LCDbg0 = 0; /* LCD background dark */
42 static Uint32 LCDbg1 = 0; /* LCD background light */
41 43
42 extern int my_shutdown; 44 extern int my_shutdown;
43 45
44 46
45 /*-----------------------------------------------------------------------*/ 47 /*-----------------------------------------------------------------------*/
249 { 251 {
250 SDL_Rect sr, dr; 252 SDL_Rect sr, dr;
251 Uint32 bg; 253 Uint32 bg;
252 254
253 if (bLight) 255 if (bLight)
254 bg = SDL_MapRGB(pSdlGuiScrn->format,156,235, 4); 256 bg = LCDbg1;
255 else 257 else
256 bg = SDL_MapRGB(pSdlGuiScrn->format, 94,147, 69); 258 bg = LCDbg0;
257 259
258 sr.x=fontwidth*(c%16); 260 sr.x=fontwidth*(c%16);
259 sr.y=fontheight*(c/16); 261 sr.y=fontheight*(c/16);
260 sr.w=fontwidth; 262 sr.w=fontwidth;
261 sr.h=fontheight; 263 sr.h=fontheight;
315 */ 317 */
316 static void SDLGui_DrawLCD(const SGOBJ *bdlg, int objnum) 318 static void SDLGui_DrawLCD(const SGOBJ *bdlg, int objnum)
317 { 319 {
318 SDL_Rect rect; 320 SDL_Rect rect;
319 int x, y, w, h, offset, border = 4; 321 int x, y, w, h, offset, border = 4;
320 Uint32 bg0 = SDL_MapRGB(pSdlGuiScrn->format, 94,147, 69);
321 Uint32 bg1 = SDL_MapRGB(pSdlGuiScrn->format,156,235, 4);
322 Uint32 bc = SDL_MapRGB(pSdlGuiScrn->format, 32, 32, 32); 322 Uint32 bc = SDL_MapRGB(pSdlGuiScrn->format, 32, 32, 32);
323 Uint32 bg; 323 Uint32 bg;
324 324
325 LCDbg0 = SDL_MapRGB(pSdlGuiScrn->format, 94,147, 69);
326 LCDbg1 = SDL_MapRGB(pSdlGuiScrn->format,156,235, 4);
325 /* 327 /*
326 * Width and height are given in character columns and rows, 328 * Width and height are given in character columns and rows,
327 * so calculate the display size in pixels. 329 * so calculate the display size in pixels.
328 */ 330 */
329 w = bdlg[objnum].w * (fontwidth + 2) + 10; 331 w = bdlg[objnum].w * (fontwidth + 2) + 10;
343 x += bdlg[0].x; /* add its absolute coordinates if we need to */ 345 x += bdlg[0].x; /* add its absolute coordinates if we need to */
344 y += bdlg[0].y; 346 y += bdlg[0].y;
345 } 347 }
346 348
347 if (bdlg[objnum].state & SG_SELECTED) { 349 if (bdlg[objnum].state & SG_SELECTED) {
348 bg = bg1; 350 bg = LCDbg1;
349 } else { 351 } else {
350 bg = bg0; 352 bg = LCDbg0;
351 } 353 }
352 354
353 /* The root box should be bigger than the screen, so we disable the offset there: */ 355 /* The root box should be bigger than the screen, so we disable the offset there: */
354 if (objnum != 0) 356 if (objnum != 0)
355 offset = border; 357 offset = border;

mercurial