Fri, 19 Apr 2024 20:56:55 +0200
Create global_json() for all and expanded the data to the complete setup. Added design for the global setup.
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
1 | /***************************************************************************** |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
605
diff
changeset
|
2 | * Copyright (C) 2015-2024 |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
3 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
4 | * Michiel Broek <mbroek at mbse dot eu> |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
5 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
6 | * This file is part of the mbsePi-apps emulator |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
7 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
8 | * The gui code is based on the gui from the emulator ARAnyM, |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
9 | * Copyright (c) 2004 Petr Stehlik of ARAnyM dev team |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
10 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
11 | * This progrm is free software; you can redistribute it and/or modify it |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
12 | * under the terms of the GNU General Public License as published by the |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
13 | * Free Software Foundation; either version 2, or (at your option) any |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
14 | * later version. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
15 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
16 | * mbsePi-apps is distributed in the hope that it will be useful, but |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
19 | * General Public License for more details. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
20 | * |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
21 | * You should have received a copy of the GNU General Public License |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
22 | * along with mbsePi-apps; see the file COPYING. If not, write to the Free |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
23 | * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
24 | *****************************************************************************/ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
25 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
26 | #include "brewpanel.h" |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
27 | #include "sdlgui.h" |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
415
diff
changeset
|
28 | #include "sockio.h" |
410
e3f8a51b566a
Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
29 | |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
605
diff
changeset
|
30 | #ifdef HAVE_SDL2_SDL_H |
410
e3f8a51b566a
Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
31 | |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
32 | #include "lcdfont10x16.h" |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
33 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
34 | |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
35 | extern SDL_Surface *S_screen; /* Pointer to the actual main SDL screen surface */ |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
36 | extern SDL_Window *S_window; /* Pointer to the actual window */ |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
37 | static SDL_Surface *pFontGfx = NULL; /* The LCD font graphics */ |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
38 | static SDL_Surface *pBgSurface; /* Pointer to the application SDL screen surface */ |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
39 | static SDL_Rect dlgrect, bgrect; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
40 | static int fontwidth, fontheight; /* Width & height of the actual font */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
41 | TTF_Font *pFont = NULL; /* TTF font for buttons etc. */ |
427
e8e548922e31
Initial part of LEDs and backlight implemented.
Michiel Broek <mbroek@mbse.eu>
parents:
425
diff
changeset
|
42 | static Uint32 LCDbg0 = 0; /* LCD background dark */ |
e8e548922e31
Initial part of LEDs and backlight implemented.
Michiel Broek <mbroek@mbse.eu>
parents:
425
diff
changeset
|
43 | static Uint32 LCDbg1 = 0; /* LCD background light */ |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
44 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
45 | extern int my_shutdown; |
431
b3895cd6edd3
Finished optional paneltype. Fixed all debug flags.
Michiel Broek <mbroek@mbse.eu>
parents:
430
diff
changeset
|
46 | extern int debug; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
47 | |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
48 | |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
49 | /*-----------------------------------------------------------------------*/ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
50 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
51 | * Load an 1 plane XBM into a 8 planes SDL_Surface. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
52 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
53 | static SDL_Surface *SDLGui_LoadXBM(int w, int h, const char *pXbmBits) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
54 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
55 | SDL_Surface *bitmap; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
56 | Uint8 *dstbits; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
57 | const Uint8 *srcbits; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
58 | int x, y, srcpitch, mask; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
59 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
60 | srcbits = (Uint8 *)pXbmBits; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
61 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
62 | /* Allocate the bitmap */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
63 | if ((bitmap = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 8, 0, 0, 0, 0)) == NULL) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
64 | syslog(LOG_NOTICE, "Failed to allocate bitmap: %s", SDL_GetError()); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
65 | return NULL; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
66 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
67 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
68 | srcpitch = ((w + 7) / 8); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
69 | dstbits = (Uint8 *)bitmap->pixels; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
70 | mask = 1; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
71 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
72 | /* Copy the pixels */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
73 | for (y = 0 ; y < h ; y++) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
74 | for (x = 0 ; x < w ; x++) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
75 | dstbits[x] = (srcbits[x / 8] & mask) ? 1 : 0; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
76 | mask <<= 1; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
77 | mask |= (mask >> 8); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
78 | mask &= 0xFF; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
79 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
80 | dstbits += bitmap->pitch; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
81 | srcbits += srcpitch; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
82 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
83 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
84 | return bitmap; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
85 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
86 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
87 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
88 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
89 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
90 | * Initialize the GUI. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
91 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
92 | int SDLGui_Init(void) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
93 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
94 | char *Pt = NULL; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
95 | |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
96 | SDL_Color blackWhiteColors[2] = {{255, 255, 255, 0}, {53, 59, 61, 0}}; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
97 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
98 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
99 | * Initialize the LCD font graphics: |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
100 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
101 | pFontGfx = SDLGui_LoadXBM(lcdfont10x16_width, lcdfont10x16_height, lcdfont10x16_bits); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
102 | if (pFontGfx == NULL) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
103 | syslog(LOG_NOTICE, "Error: Can not init font graphics!"); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
104 | return -1; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
105 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
106 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
107 | /* Set color palette of the LCD font graphics: */ |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
605
diff
changeset
|
108 | SDL_SetPaletteColors(pFontGfx->format->palette, blackWhiteColors, 0, 2); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
109 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
110 | /* Set font color 0 as transparent: */ |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
605
diff
changeset
|
111 | SDL_SetColorKey(pFontGfx, SDL_RLEACCEL, 0); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
112 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
113 | if (TTF_Init() == -1) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
114 | syslog(LOG_NOTICE, "Could not init SDL_ttf"); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
115 | return -1; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
116 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
117 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
118 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
119 | * Load TTF font for the dialogs |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
120 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
121 | Pt = calloc(1024, sizeof(char)); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
122 | sprintf(Pt, "%s", "/usr/share/fonts/TTF/DejaVuSans.ttf"); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
123 | if ((pFont = TTF_OpenFont(Pt, 14 )) == NULL) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
124 | sprintf(Pt, "%s", "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf"); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
125 | if ((pFont = TTF_OpenFont(Pt, 14 )) == NULL) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
126 | sprintf(Pt, "%s", "/usr/share/fonts/truetype/freefont/DejaVuSans.ttf"); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
127 | if ((pFont = TTF_OpenFont(Pt, 14 )) == NULL) { |
605
e00f8ff4de9a
Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.
Michiel Broek <mbroek@mbse.eu>
parents:
443
diff
changeset
|
128 | sprintf(Pt, "%s", "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf"); |
e00f8ff4de9a
Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.
Michiel Broek <mbroek@mbse.eu>
parents:
443
diff
changeset
|
129 | if ((pFont = TTF_OpenFont(Pt, 14 )) == NULL) { |
e00f8ff4de9a
Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.
Michiel Broek <mbroek@mbse.eu>
parents:
443
diff
changeset
|
130 | syslog(LOG_NOTICE, "Could not load DejaVuSans.ttf"); |
e00f8ff4de9a
Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.
Michiel Broek <mbroek@mbse.eu>
parents:
443
diff
changeset
|
131 | return -1; |
e00f8ff4de9a
Version 0.9.8. Added extra path to the fonts for Debian buster. Changed the PID to work on Proportional on Measurement. Added loops so that it looks like the PID is running at 100 mSec intervals.
Michiel Broek <mbroek@mbse.eu>
parents:
443
diff
changeset
|
132 | } |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
133 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
134 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
135 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
136 | syslog(LOG_NOTICE, "Using ttf font: %s\n", Pt); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
137 | free(Pt); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
138 | Pt = NULL; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
139 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
140 | return 0; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
141 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
142 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
143 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
144 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
145 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
146 | * Uninitialize the GUI. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
147 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
148 | int SDLGui_UnInit(void) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
149 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
150 | if (pFont) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
151 | TTF_CloseFont(pFont); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
152 | pFont = NULL; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
153 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
154 | if (pFontGfx) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
155 | SDL_FreeSurface(pFontGfx); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
156 | pFontGfx = NULL; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
157 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
158 | return 0; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
159 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
160 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
161 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
162 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
163 | /* |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
164 | * Prepare the font to suit the actual resolution. |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
165 | */ |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
166 | int SDLGui_SetScreen(void) |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
167 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
168 | if (pFontGfx == NULL) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
169 | syslog(LOG_NOTICE, "Error: A problem with the font occured!"); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
170 | return -1; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
171 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
172 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
173 | /* Get the font width and height: */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
174 | fontwidth = pFontGfx->w/16; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
175 | fontheight = pFontGfx->h/16; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
176 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
177 | return 0; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
178 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
179 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
180 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
181 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
182 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
183 | * Center a dialog so that it appears in the middle of the screen. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
184 | * Note: We only store the coordinates in the root box of the dialog, |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
185 | * all other objects in the dialog are positioned relatively to this one. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
186 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
187 | void SDLGui_CenterDlg(SGOBJ *dlg) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
188 | { |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
189 | dlg[0].x = (S_screen->w/1-dlg[0].w)/2; |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
190 | dlg[0].y = (S_screen->h/1-dlg[0].h)/2; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
191 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
192 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
193 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
194 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
195 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
196 | * Draw a text string using TTF |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
197 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
198 | static void SDLGui_TTF(int x, int y, const char *txt) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
199 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
200 | SDL_Rect offset; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
201 | SDL_Color textColor = { 0, 0, 0 }; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
202 | SDL_Surface* message = NULL; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
203 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
204 | message = TTF_RenderText_Solid(pFont, txt, textColor); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
205 | offset.x = x; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
206 | offset.y = y; |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
207 | SDL_BlitSurface(message, NULL, S_screen, &offset); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
208 | SDL_FreeSurface(message); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
209 | message = NULL; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
210 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
211 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
212 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
213 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
214 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
215 | * Draw a dialog TTF text object. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
216 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
217 | static void SDLGui_DrawTTF(const SGOBJ *tdlg, int objnum) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
218 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
219 | int x, y; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
220 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
221 | x = (tdlg[0].x + tdlg[objnum].x); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
222 | y = (tdlg[0].y + tdlg[objnum].y); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
223 | SDLGui_TTF(x, y, tdlg[objnum].txt); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
224 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
225 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
226 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
227 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
228 | /* |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
229 | * Draw the cursor |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
230 | */ |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
231 | void SDLGui_Cursor(SGOBJ *dlg, int fd, int x, int y, int on, int blink) |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
232 | { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
233 | SDL_Rect dr; |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
234 | Uint32 color = SDL_MapRGB(S_screen->format, 53, 59, 61); |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
235 | |
415
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
236 | if (on) { |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
237 | dr.x = x; |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
238 | dr.y = y + fontheight - 2; |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
239 | dr.w = fontwidth; |
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
240 | dr.h = 2; |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
241 | |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
242 | SDL_FillRect(S_screen, &dr, color); |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
243 | SDL_UpdateWindowSurface(S_window); |
415
d9b7e0705f56
Added cursor control, but no blinking yet.
Michiel Broek <mbroek@mbse.eu>
parents:
412
diff
changeset
|
244 | } |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
245 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
246 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
247 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
248 | |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
249 | void SDLGui_CGChar(SGOBJ *dlg, int fd, int x, int y, Uint8 data[8]) |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
250 | { |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
251 | int i, j, x1, x2, y1, y2, dstpitch = 0; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
252 | SDL_Rect sr, dr; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
253 | Uint32 bg; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
254 | Uint8 *dstbits = NULL, mask; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
255 | SDL_Surface *CGchar; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
256 | SDL_Color blackWhiteColors[2] = {{255, 255, 255, 0}, {53, 59, 61, 0}}; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
257 | |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
258 | CGchar = SDL_CreateRGBSurface(SDL_SWSURFACE, 10, 16, 8, 0, 0, 0, 0); |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
259 | if (CGchar == NULL) { |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
260 | fprintf(stderr, "SDLGui_CGChar Can not init font graphics!\n"); |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
261 | return; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
262 | } |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
263 | dstbits = (Uint8 *)CGchar->pixels; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
264 | dstpitch = CGchar->pitch; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
265 | mask = 0x10; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
266 | i = j = 0; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
267 | |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
268 | /* |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
269 | * Create a bitmap with the character pixels |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
270 | */ |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
271 | for (y1 = 0; y1 < 8; y1++) { |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
272 | for (y2 = 0; y2 < 2; y2++) { |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
273 | j = 0; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
274 | for (x1 = 0; x1 < 5; x1++) { |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
275 | for (x2 = 0; x2 < 2; x2++) { |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
276 | dstbits[j] = (data[i] & mask) ? 1 : 0; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
277 | j++; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
278 | } |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
279 | mask >>= 1; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
280 | if (! mask) |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
281 | mask = 0x10; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
282 | } |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
283 | dstbits += dstpitch; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
284 | } |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
285 | i++; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
286 | } |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
287 | |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
288 | SDL_SetPaletteColors(CGchar->format->palette, blackWhiteColors, 0, 2); |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
605
diff
changeset
|
289 | SDL_SetColorKey(CGchar, SDL_RLEACCEL, 0); |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
290 | if (dlg[1].state & SG_SELECTED) { |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
291 | bg = LCDbg1; |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
292 | } else { |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
293 | bg = LCDbg0; |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
294 | } |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
295 | |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
296 | sr.x = sr.y = 0; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
297 | dr.x = x; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
298 | dr.y = y; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
299 | sr.w = dr.w = fontwidth; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
300 | sr.h = dr.h = fontheight; |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
301 | |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
302 | SDL_FillRect(S_screen, &dr, bg); |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
303 | SDL_BlitSurface(CGchar, &sr, S_screen, &dr); |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
605
diff
changeset
|
304 | SDL_UpdateWindowSurface(S_window); |
443
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
305 | SDL_FreeSurface(CGchar); |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
306 | } |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
307 | |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
308 | |
6b80a37fdf8d
Added programming display CGRAM. Added display of characters from CGRAM. Changed prompts to allow free prompt strings. More code for the brewsystem unit editor.
Michiel Broek <mbroek@mbse.eu>
parents:
431
diff
changeset
|
309 | |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
310 | /* |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
311 | * Draw a text character |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
312 | */ |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
313 | void SDLGui_Char(SGOBJ *dlg, int fd, int x, int y, Uint8 c) |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
314 | { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
315 | SDL_Rect sr, dr; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
316 | Uint32 bg; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
317 | |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
318 | if (dlg[1].state & SG_SELECTED) { |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
319 | bg = LCDbg1; |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
320 | } else { |
427
e8e548922e31
Initial part of LEDs and backlight implemented.
Michiel Broek <mbroek@mbse.eu>
parents:
425
diff
changeset
|
321 | bg = LCDbg0; |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
322 | } |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
323 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
324 | sr.x=fontwidth*(c%16); |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
325 | sr.y=fontheight*(c/16); |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
326 | sr.w=fontwidth; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
327 | sr.h=fontheight; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
328 | dr.x=x; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
329 | dr.y=y; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
330 | dr.w=fontwidth; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
331 | dr.h=fontheight; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
332 | |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
333 | SDL_FillRect(S_screen, &dr, bg); |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
334 | SDL_BlitSurface(pFontGfx, &sr, S_screen, &dr); |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
605
diff
changeset
|
335 | SDL_UpdateWindowSurface(S_window); |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
336 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
337 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
338 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
339 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
340 | /* |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
341 | * Draw a text string. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
342 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
343 | static void SDLGui_Text(int x, int y, const char *txt) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
344 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
345 | int i; |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
346 | Uint8 c; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
347 | SDL_Rect sr, dr; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
348 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
349 | for (i=0; txt[i]!=0; i++) { |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
350 | c = txt[i] & 0xff; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
351 | sr.x=fontwidth*(c%16); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
352 | sr.y=fontheight*(c/16); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
353 | sr.w=fontwidth; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
354 | sr.h=fontheight; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
355 | dr.x=x+i*(fontwidth+2); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
356 | dr.y=y; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
357 | dr.w=fontwidth; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
358 | dr.h=fontheight; |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
359 | SDL_BlitSurface(pFontGfx, &sr, S_screen, &dr); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
360 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
361 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
362 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
363 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
364 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
365 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
366 | * Draw a dialog text object. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
367 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
368 | static void SDLGui_DrawText(const SGOBJ *tdlg, int objnum) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
369 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
370 | int x, y; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
371 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
372 | x = (tdlg[0].x + tdlg[objnum].x); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
373 | y = (tdlg[0].y + tdlg[objnum].y); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
374 | SDLGui_Text(x, y, tdlg[objnum].txt); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
375 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
376 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
377 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
378 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
379 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
380 | * Draw a dialog LCD object. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
381 | */ |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
382 | void SDLGui_DrawLCD(SGOBJ *bdlg, int objnum) |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
383 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
384 | SDL_Rect rect; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
385 | int x, y, w, h, offset, border = 4; |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
386 | Uint32 bc = SDL_MapRGB(S_screen->format, 32, 32, 32); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
387 | Uint32 bg; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
388 | |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
389 | LCDbg0 = SDL_MapRGB(S_screen->format, 94,147, 69); |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
390 | LCDbg1 = SDL_MapRGB(S_screen->format,156,235, 4); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
391 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
392 | * Width and height are given in character columns and rows, |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
393 | * so calculate the display size in pixels. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
394 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
395 | w = bdlg[objnum].w * (fontwidth + 2) + 10; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
396 | h = bdlg[objnum].h * (fontheight + 2) + 4; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
397 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
398 | if (bdlg[objnum].x == -1) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
399 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
400 | * Auto center |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
401 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
402 | x = (bdlg[0].w - w) / 2; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
403 | } else { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
404 | x = bdlg[objnum].x; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
405 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
406 | y = bdlg[objnum].y; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
407 | if (objnum > 0) { /* Since the root object is a box, too, */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
408 | /* we have to look for it now here and only */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
409 | x += bdlg[0].x; /* add its absolute coordinates if we need to */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
410 | y += bdlg[0].y; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
411 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
412 | |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
413 | if (bdlg[objnum].state & SG_SELECTED) { |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
414 | bg = LCDbg1; |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
415 | } else { |
427
e8e548922e31
Initial part of LEDs and backlight implemented.
Michiel Broek <mbroek@mbse.eu>
parents:
425
diff
changeset
|
416 | bg = LCDbg0; |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
417 | } |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
418 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
419 | /* The root box should be bigger than the screen, so we disable the offset there: */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
420 | if (objnum != 0) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
421 | offset = border; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
422 | else |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
423 | offset = 0; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
424 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
425 | /* Draw background: */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
426 | rect.x = x; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
427 | rect.y = y; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
428 | rect.w = w; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
429 | rect.h = h; |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
430 | SDL_FillRect(S_screen, &rect, bg); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
431 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
432 | /* Draw upper border: */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
433 | rect.x = x - offset; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
434 | rect.y = y - offset; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
435 | rect.w = w + offset + offset; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
436 | rect.h = border; |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
437 | SDL_FillRect(S_screen, &rect, bc); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
438 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
439 | /* Draw left border: */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
440 | rect.x = x - offset; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
441 | rect.y = y; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
442 | rect.w = border; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
443 | rect.h = h; |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
444 | SDL_FillRect(S_screen, &rect, bc); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
445 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
446 | /* Draw bottom border: */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
447 | rect.x = x - offset; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
448 | rect.y = y + h - border + offset; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
449 | rect.w = w + offset + offset; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
450 | rect.h = border; |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
451 | SDL_FillRect(S_screen, &rect, bc); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
452 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
453 | /* Draw right border: */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
454 | rect.x = x + w - border + offset; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
455 | rect.y = y; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
456 | rect.w = border; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
457 | rect.h = h; |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
458 | SDL_FillRect(S_screen, &rect, bc); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
459 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
460 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
461 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
462 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
463 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
464 | * Draw a dialog box object. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
465 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
466 | static void SDLGui_DrawBox(const SGOBJ *bdlg, int objnum) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
467 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
468 | SDL_Rect rect; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
469 | int x, y, w, h, offset, shade = 2; |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
470 | Uint32 grey = SDL_MapRGB(S_screen->format,192,192,192); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
471 | Uint32 upleftc, downrightc; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
472 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
473 | x = bdlg[objnum].x; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
474 | y = bdlg[objnum].y; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
475 | if (objnum > 0) { /* Since the root object is a box, too, */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
476 | /* we have to look for it now here and only */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
477 | x += bdlg[0].x; /* add its absolute coordinates if we need to */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
478 | y += bdlg[0].y; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
479 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
480 | w = bdlg[objnum].w; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
481 | h = bdlg[objnum].h; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
482 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
483 | if (bdlg[objnum].state & SG_SELECTED) { |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
484 | upleftc = SDL_MapRGB(S_screen->format,128,128,128); |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
485 | downrightc = SDL_MapRGB(S_screen->format,255,255,255); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
486 | } else { |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
487 | upleftc = SDL_MapRGB(S_screen->format,255,255,255); |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
488 | downrightc = SDL_MapRGB(S_screen->format,128,128,128); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
489 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
490 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
491 | /* The root box should be bigger than the screen, so we disable the offset there: */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
492 | if (objnum != 0) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
493 | offset = shade; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
494 | else |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
495 | offset = 0; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
496 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
497 | /* Draw background: */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
498 | rect.x = x; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
499 | rect.y = y; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
500 | rect.w = w; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
501 | rect.h = h; |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
502 | SDL_FillRect(S_screen, &rect, grey); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
503 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
504 | /* Draw upper border: */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
505 | rect.x = x; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
506 | rect.y = y - offset; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
507 | rect.w = w; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
508 | rect.h = shade; |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
509 | SDL_FillRect(S_screen, &rect, upleftc); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
510 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
511 | /* Draw left border: */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
512 | rect.x = x - offset; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
513 | rect.y = y; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
514 | rect.w = shade; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
515 | rect.h = h; |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
516 | SDL_FillRect(S_screen, &rect, upleftc); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
517 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
518 | /* Draw bottom border: */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
519 | rect.x = x; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
520 | rect.y = y + h - shade + offset; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
521 | rect.w = w; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
522 | rect.h = shade; |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
523 | SDL_FillRect(S_screen, &rect, downrightc); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
524 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
525 | /* Draw right border: */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
526 | rect.x = x + w - shade + offset; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
527 | rect.y = y; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
528 | rect.w = shade; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
529 | rect.h = h; |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
530 | SDL_FillRect(S_screen, &rect, downrightc); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
531 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
532 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
533 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
534 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
535 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
536 | * Draw a normal button. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
537 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
538 | static void SDLGui_DrawButton(const SGOBJ *bdlg, int objnum) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
539 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
540 | int x, y, w, h; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
541 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
542 | SDLGui_DrawBox(bdlg, objnum); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
543 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
544 | * Use bold text and get outer dimensions of the text |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
545 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
546 | TTF_SetFontStyle(pFont, TTF_STYLE_BOLD); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
547 | TTF_SizeText(pFont, bdlg[objnum].txt, &w, &h); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
548 | x = bdlg[0].x + bdlg[objnum].x + (bdlg[objnum].w - w) / 2; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
549 | y = bdlg[0].y + bdlg[objnum].y + (bdlg[objnum].h - h) / 2; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
550 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
551 | if (bdlg[objnum].state & SG_SELECTED) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
552 | x += 1; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
553 | y += 1; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
554 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
555 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
556 | if ((bdlg[objnum].flags & SG_HIDE) == 0) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
557 | SDLGui_TTF(x, y, bdlg[objnum].txt); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
558 | TTF_SetFontStyle(pFont, TTF_STYLE_NORMAL); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
559 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
560 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
561 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
562 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
563 | /* |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
564 | * SDL_Surface 32-bit circle-fill algorithm without using trig |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
565 | * |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
566 | * While I humbly call this "Celdecea's Method", odds are that the |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
567 | * procedure has already been documented somewhere long ago. All of |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
568 | * the circle-fill examples I came across utilized trig functions or |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
569 | * scanning neighbor pixels. This algorithm identifies the width of |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
570 | * a semi-circle at each pixel height and draws a scan-line covering |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
571 | * that width. |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
572 | * |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
573 | * The code is not optimized but very fast, owing to the fact that it |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
574 | * alters pixels in the provided surface directly rather than through |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
575 | * function calls. |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
576 | */ |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
577 | void SDLGui_fill_circle(SDL_Surface *surface, int cx, int cy, int radius, Uint32 pixel) |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
578 | { |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
579 | /* |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
580 | * Note that there is more to altering the bitrate of this |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
581 | * method than just changing this value. See how pixels are |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
582 | * altered at the following web page for tips: |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
583 | * http://www.libsdl.org/intro.en/usingvideo.html |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
584 | */ |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
585 | static const int BPP = 4; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
586 | double r = (double)radius; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
587 | double dy; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
588 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
589 | for (dy = 1; dy <= r; dy += 1.0) { |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
590 | /* |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
591 | * This loop is unrolled a bit, only iterating through half of the |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
592 | * height of the circle. The result is used to draw a scan line and |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
593 | * its mirror image below it. |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
594 | * |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
595 | * The following formula has been simplified from our original. We |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
596 | * are using half of the width of the circle because we are provided |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
597 | * with a center and we need left/right coordinates. |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
598 | */ |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
599 | double dx = floor(sqrt((2.0 * r * dy) - (dy * dy))); |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
600 | int x = cx - dx; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
601 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
602 | // Grab a pointer to the left-most pixel for each half of the circle |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
603 | Uint8 *target_pixel_a = (Uint8 *)surface->pixels + ((int)(cy + r - dy)) * surface->pitch + x * BPP; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
604 | Uint8 *target_pixel_b = (Uint8 *)surface->pixels + ((int)(cy - r + dy)) * surface->pitch + x * BPP; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
605 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
606 | for (; x <= cx + dx; x++) { |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
607 | *(Uint32 *)target_pixel_a = pixel; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
608 | *(Uint32 *)target_pixel_b = pixel; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
609 | target_pixel_a += BPP; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
610 | target_pixel_b += BPP; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
611 | } |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
612 | } |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
613 | } |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
614 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
615 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
616 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
617 | static void SDLGUI_DrawLEDRed(const SGOBJ *bdlg, int objnum) |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
618 | { |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
619 | Uint32 color; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
620 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
621 | if (bdlg[objnum].state & SG_SELECTED) { |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
622 | color = SDL_MapRGB(S_screen->format, 255, 64, 0); |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
623 | } else { |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
624 | color = SDL_MapRGB(S_screen->format, 128, 16, 0); |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
625 | } |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
626 | SDLGui_fill_circle(S_screen, bdlg[objnum].x, bdlg[objnum].y, bdlg[objnum].w, color); |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
627 | } |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
628 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
629 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
630 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
631 | static void SDLGUI_DrawLEDBlue(const SGOBJ *bdlg, int objnum) |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
632 | { |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
633 | Uint32 color; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
634 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
635 | if (bdlg[objnum].state & SG_SELECTED) { |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
636 | color = SDL_MapRGB(S_screen->format, 64, 160, 255); |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
637 | } else { |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
638 | color = SDL_MapRGB(S_screen->format, 16, 48, 112); |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
639 | } |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
640 | SDLGui_fill_circle(S_screen, bdlg[objnum].x, bdlg[objnum].y, bdlg[objnum].w, color); |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
641 | } |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
642 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
643 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
644 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
645 | static void SDLGUI_DrawLEDGreen(const SGOBJ *bdlg, int objnum) |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
646 | { |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
647 | Uint32 color; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
648 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
649 | if (bdlg[objnum].state & SG_SELECTED) { |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
650 | color = SDL_MapRGB(S_screen->format, 80, 240, 0); |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
651 | } else { |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
652 | color = SDL_MapRGB(S_screen->format, 32, 112, 0); |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
653 | } |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
654 | SDLGui_fill_circle(S_screen, bdlg[objnum].x, bdlg[objnum].y, bdlg[objnum].w, color); |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
655 | } |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
656 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
657 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
658 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
659 | static void SDLGUI_DrawLEDYellow(const SGOBJ *bdlg, int objnum) |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
660 | { |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
661 | Uint32 color; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
662 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
663 | if (bdlg[objnum].state & SG_SELECTED) { |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
664 | color = SDL_MapRGB(S_screen->format, 255, 255, 0); |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
665 | } else { |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
666 | color = SDL_MapRGB(S_screen->format, 160, 144, 0); |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
667 | } |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
668 | SDLGui_fill_circle(S_screen, bdlg[objnum].x, bdlg[objnum].y, bdlg[objnum].w, color); |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
669 | } |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
670 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
671 | |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
672 | |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
673 | void SDLGui_LED(SGOBJ *dlg, int fd, int LED, int on) |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
674 | { |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
675 | int i; |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
676 | |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
677 | for (i = 0; dlg[i].type != -1; i++) { |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
678 | if (dlg[i].type == LED) { |
431
b3895cd6edd3
Finished optional paneltype. Fixed all debug flags.
Michiel Broek <mbroek@mbse.eu>
parents:
430
diff
changeset
|
679 | if (debug) |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
680 | fprintf(stdout, "SDLGui_LED LED=%d on=%d\n", LED, on); |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
681 | if (on) { |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
682 | dlg[i].state |= SG_SELECTED; |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
683 | } else { |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
684 | dlg[i].state &= ~SG_SELECTED; |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
685 | } |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
686 | switch (dlg[i].type) { |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
687 | case SGLEDRED: |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
688 | SDLGUI_DrawLEDRed(dlg, i); |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
689 | break; |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
690 | case SGLEDBLUE: |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
691 | SDLGUI_DrawLEDBlue(dlg, i); |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
692 | break; |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
693 | case SGLEDGREEN: |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
694 | SDLGUI_DrawLEDGreen(dlg, i); |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
695 | break; |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
696 | case SGLEDYELLOW: |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
697 | SDLGUI_DrawLEDYellow(dlg, i); |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
698 | break; |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
699 | } |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
605
diff
changeset
|
700 | SDL_UpdateWindowSurface(S_window); |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
701 | } |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
702 | } |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
703 | } |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
704 | |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
705 | |
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
706 | |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
707 | /* |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
708 | * Draw a whole dialog. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
709 | */ |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
710 | void SDLGui_DrawDialog(SGOBJ *dlg) |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
711 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
712 | int i; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
713 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
714 | for (i = 0; dlg[i].type != -1; i++) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
715 | switch (dlg[i].type) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
716 | case SGBOX: |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
717 | SDLGui_DrawBox(dlg, i); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
718 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
719 | case SGLCD: |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
720 | SDLGui_DrawLCD(dlg, i); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
721 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
722 | case SGTEXT: |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
723 | SDLGui_DrawText(dlg, i); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
724 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
725 | case SGTTF: |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
726 | SDLGui_DrawTTF(dlg, i); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
727 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
728 | case SGBUTTON: |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
729 | SDLGui_DrawButton(dlg, i); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
730 | break; |
425
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
731 | case SGLEDRED: |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
732 | SDLGUI_DrawLEDRed(dlg, i); |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
733 | break; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
734 | case SGLEDBLUE: |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
735 | SDLGUI_DrawLEDBlue(dlg, i); |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
736 | break; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
737 | case SGLEDGREEN: |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
738 | SDLGUI_DrawLEDGreen(dlg, i); |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
739 | break; |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
740 | case SGLEDYELLOW: |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
741 | SDLGUI_DrawLEDYellow(dlg, i); |
c51265b518ce
Added LED objects to the SDL panel.
Michiel Broek <mbroek@mbse.eu>
parents:
422
diff
changeset
|
742 | break; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
743 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
744 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
745 | |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
605
diff
changeset
|
746 | SDL_UpdateWindowSurface(S_window); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
747 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
748 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
749 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
750 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
751 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
752 | * Search an object at a certain position. |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
753 | */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
754 | static int SDLGui_FindObj(const SGOBJ *dlg, int fx, int fy) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
755 | { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
756 | int len, i, ob = -1, xpos, ypos; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
757 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
758 | len = 0; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
759 | while (dlg[len].type != -1) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
760 | len++; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
761 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
762 | xpos = fx; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
763 | ypos = fy; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
764 | /* Now search for the object: */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
765 | for (i = len; i >= 0; i--) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
766 | if (xpos >= dlg[0].x + dlg[i].x && ypos >= dlg[0].y + dlg[i].y && |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
767 | xpos < dlg[0].x + dlg[i].x + dlg[i].w && ypos < dlg[0].y + dlg[i].y + dlg[i].h) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
768 | ob = i; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
769 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
770 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
771 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
772 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
773 | return ob; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
774 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
775 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
776 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
777 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
778 | /* |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
779 | * Show dialog. |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
780 | */ |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
781 | int SDLGui_DoDialogInit(SGOBJ *dlg) |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
782 | { |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
783 | if ((S_screen->h < dlg[0].h) && (S_screen->w < dlg[0].w)) { |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
784 | syslog(LOG_NOTICE, "Screen size too small for dialog!"); |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
785 | return SDLGUI_ERROR; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
786 | } |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
787 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
788 | dlgrect.x = dlg[0].x; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
789 | dlgrect.y = dlg[0].y; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
790 | dlgrect.w = dlg[0].w; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
791 | dlgrect.h = dlg[0].h; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
792 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
793 | bgrect.x = bgrect.y = 0; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
794 | bgrect.w = dlgrect.w; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
795 | bgrect.h = dlgrect.h; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
796 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
797 | /* |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
798 | * Save background |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
799 | */ |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
800 | pBgSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, dlgrect.w, dlgrect.h, S_screen->format->BitsPerPixel, |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
801 | S_screen->format->Rmask, S_screen->format->Gmask, S_screen->format->Bmask, S_screen->format->Amask); |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
802 | if (S_screen->format->palette != NULL) { |
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
803 | SDL_SetPaletteColors(pBgSurface->format->palette, S_screen->format->palette->colors, 0, S_screen->format->palette->ncolors-1); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
804 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
805 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
806 | if (pBgSurface != NULL) { |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
807 | SDL_BlitSurface(S_screen, &dlgrect, pBgSurface, &bgrect); |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
808 | } else { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
809 | syslog(LOG_NOTICE, "SDLGUI_DoDialog: CreateRGBSurface failed: %s", SDL_GetError()); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
810 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
811 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
812 | /* (Re-)draw the dialog */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
813 | SDLGui_DrawDialog(dlg); |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
814 | return 0; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
815 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
816 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
817 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
818 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
819 | /* |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
820 | * Process a dialog. Returns the button number that has been pressed |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
821 | */ |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
822 | int SDLGui_DoDialogLoop(SGOBJ *dlg) |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
823 | { |
422
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
824 | int obj = 0, retbutton = 0; |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
825 | SDL_Event sdlEvent; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
826 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
827 | /* The main loop */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
828 | while (retbutton == 0 && !my_shutdown) { |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
415
diff
changeset
|
829 | |
422
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
830 | /* |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
831 | * Poll network for data |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
832 | */ |
428
d64c4c1edd78
Fixed parameters pasing between different layers.
Michiel Broek <mbroek@mbse.eu>
parents:
427
diff
changeset
|
833 | socket_recv(dlg); |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
415
diff
changeset
|
834 | |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
415
diff
changeset
|
835 | if (SDL_PollEvent(&sdlEvent) == 1) { /* Wait for events */ |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
836 | switch (sdlEvent.type) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
837 | case SDL_QUIT: |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
838 | retbutton = SDLGUI_QUIT; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
839 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
840 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
841 | case SDL_MOUSEBUTTONDOWN: |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
842 | if (sdlEvent.button.button != SDL_BUTTON_LEFT) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
843 | /* Not left mouse button -> unsupported event */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
844 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
845 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
846 | /* It was the left button: Find the object under the mouse cursor */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
847 | obj = SDLGui_FindObj(dlg, sdlEvent.button.x, sdlEvent.button.y); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
848 | if (obj > 0) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
849 | if (dlg[obj].type == SGBUTTON) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
850 | dlg[obj].state |= SG_SELECTED; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
851 | SDLGui_DrawButton(dlg, obj); |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
605
diff
changeset
|
852 | SDL_UpdateWindowSurface(S_window); |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
853 | //SDL_UpdateRect(S_screen, dlg[0].x + dlg[obj].x - 2, dlg[0].y + dlg[obj].y - 2, dlg[obj].w + 4, dlg[obj].h + 4); |
422
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
854 | retbutton = obj + 1000; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
855 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
856 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
857 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
858 | |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
859 | case SDL_MOUSEBUTTONUP: |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
860 | if (sdlEvent.button.button != SDL_BUTTON_LEFT) { |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
861 | /* Not left mouse button -> unsupported event */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
862 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
863 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
864 | /* It was the left button: Find the object under the mouse cursor */ |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
865 | obj = SDLGui_FindObj(dlg, sdlEvent.button.x, sdlEvent.button.y); |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
866 | if (obj > 0) { |
422
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
867 | if (dlg[obj].type == SGBUTTON) { |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
868 | dlg[obj].state &= ~SG_SELECTED; |
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
869 | SDLGui_DrawButton(dlg, obj); |
637
21e542c15832
Add --enable-wiringpi to configure script to allow to disable wiringpi even when it is installed. Use SDL2 instead of partly old SDL.
Michiel Broek <mbroek@mbse.eu>
parents:
605
diff
changeset
|
870 | SDL_UpdateWindowSurface(S_window); |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
871 | //SDL_UpdateRect(S_screen, dlg[0].x + dlg[obj].x - 2, dlg[0].y + dlg[obj].y - 2, dlg[obj].w + 4, dlg[obj].h + 4); |
422
13502d0dda65
The brewpanel works, but still needs a lot more
Michiel Broek <mbroek@mbse.eu>
parents:
420
diff
changeset
|
872 | retbutton = obj; |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
873 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
874 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
875 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
876 | |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
877 | case SDL_MOUSEMOTION: |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
878 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
879 | |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
880 | case SDL_KEYDOWN: /* Key pressed */ |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
881 | break; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
882 | } |
420
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
415
diff
changeset
|
883 | } else { |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
415
diff
changeset
|
884 | SDL_Delay(1); |
644a6106d712
The first ideas of the brewpanel simulation are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
415
diff
changeset
|
885 | } |
409
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
886 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
887 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
888 | if (retbutton == SDLGUI_QUIT) |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
889 | my_shutdown = TRUE; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
890 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
891 | return retbutton; |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
892 | } |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
893 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
894 | |
cdf68044adaf
Added a new brewpanel program that runs on an SDL/X screen. It will be an emulator for the hardware panels. Development version 0.5.0
Michiel Broek <mbroek@mbse.eu>
parents:
diff
changeset
|
895 | |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
896 | void SDLGui_DoDialogEnd(void) |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
897 | { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
898 | /* Restore background */ |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
899 | if (pBgSurface) { |
638
186f0c2d3e76
Final rebuild brewpanel to SDL2
Michiel Broek <mbroek@mbse.eu>
parents:
637
diff
changeset
|
900 | SDL_BlitSurface(pBgSurface, &bgrect, S_screen, &dlgrect); |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
901 | SDL_FreeSurface(pBgSurface); |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
902 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
903 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
904 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
905 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
906 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
907 | /* |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
908 | * Initialize a LCD object. Set the coordinates and dimenstions. Return index. |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
909 | */ |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
910 | int SDLGui_LCDinit(SGOBJ *dlg, int *x, int *y, int *w, int *h, int *cols, int *rows, int lcdindex) |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
911 | { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
912 | int i, index; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
913 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
914 | /* |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
915 | * Search the LCD display |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
916 | */ |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
917 | *x = *y = *w = *h = *cols = *rows = i = index = 0; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
918 | for (;;) { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
919 | if (dlg[i].type == -1) { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
920 | syslog(LOG_NOTICE, "SDLGui_LCDinit() lcdindex=%d not found", lcdindex); |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
921 | return -1; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
922 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
923 | if (dlg[i].type == SGLCD) { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
924 | if (index == lcdindex) |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
925 | break; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
926 | index++; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
927 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
928 | i++; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
929 | } |
431
b3895cd6edd3
Finished optional paneltype. Fixed all debug flags.
Michiel Broek <mbroek@mbse.eu>
parents:
430
diff
changeset
|
930 | if (debug) |
b3895cd6edd3
Finished optional paneltype. Fixed all debug flags.
Michiel Broek <mbroek@mbse.eu>
parents:
430
diff
changeset
|
931 | fprintf(stdout, "SDLGui_LCDinit=%d LCD=%dx%d %dx%d\n", i, dlg[i].x, dlg[i].y, dlg[i].w, dlg[i].h); |
412
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
932 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
933 | *cols = dlg[i].w; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
934 | *rows = dlg[i].h; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
935 | *w = dlg[i].w * (fontwidth + 2) + 10; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
936 | *h = dlg[i].h * (fontheight + 2) + 4; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
937 | if (dlg[i].x == -1) { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
938 | *x = (dlg[0].w - *w) / 2; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
939 | } else { |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
940 | *x = dlg[i].x; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
941 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
942 | *y = dlg[i].y; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
943 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
944 | return lcdindex; |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
945 | } |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
946 | |
f1a042a59b61
Basic ideas to write to the simulated LCD display are in place.
Michiel Broek <mbroek@mbse.eu>
parents:
410
diff
changeset
|
947 | |
410
e3f8a51b566a
Fixed compiling on systems without SDL libraries, and they don't need tha brewpanel program.
Michiel Broek <mbroek@mbse.eu>
parents:
409
diff
changeset
|
948 | #endif |