239 dr.h = 2; |
239 dr.h = 2; |
240 |
240 |
241 SDL_FillRect(pSdlGuiScrn, &dr, color); |
241 SDL_FillRect(pSdlGuiScrn, &dr, color); |
242 SDL_UpdateRect(pSdlGuiScrn, x, y, fontwidth, fontheight); |
242 SDL_UpdateRect(pSdlGuiScrn, x, y, fontwidth, fontheight); |
243 } |
243 } |
|
244 } |
|
245 |
|
246 |
|
247 |
|
248 void SDLGui_CGChar(SGOBJ *dlg, int fd, int x, int y, Uint8 data[8]) |
|
249 { |
|
250 int i, j, x1, x2, y1, y2, dstpitch = 0; |
|
251 SDL_Rect sr, dr; |
|
252 Uint32 bg; |
|
253 Uint8 *dstbits = NULL, mask; |
|
254 SDL_Surface *CGchar; |
|
255 SDL_Color blackWhiteColors[2] = {{255, 255, 255, 0}, {53, 59, 61, 0}}; |
|
256 |
|
257 CGchar = SDL_CreateRGBSurface(SDL_SWSURFACE, 10, 16, 8, 0, 0, 0, 0); |
|
258 if (CGchar == NULL) { |
|
259 fprintf(stderr, "SDLGui_CGChar Can not init font graphics!\n"); |
|
260 return; |
|
261 } |
|
262 dstbits = (Uint8 *)CGchar->pixels; |
|
263 dstpitch = CGchar->pitch; |
|
264 mask = 0x10; |
|
265 i = j = 0; |
|
266 |
|
267 /* |
|
268 * Create a bitmap with the character pixels |
|
269 */ |
|
270 for (y1 = 0; y1 < 8; y1++) { |
|
271 for (y2 = 0; y2 < 2; y2++) { |
|
272 j = 0; |
|
273 for (x1 = 0; x1 < 5; x1++) { |
|
274 for (x2 = 0; x2 < 2; x2++) { |
|
275 dstbits[j] = (data[i] & mask) ? 1 : 0; |
|
276 j++; |
|
277 } |
|
278 mask >>= 1; |
|
279 if (! mask) |
|
280 mask = 0x10; |
|
281 } |
|
282 dstbits += dstpitch; |
|
283 } |
|
284 i++; |
|
285 } |
|
286 |
|
287 SDL_SetColors(CGchar, blackWhiteColors, 0, 2); |
|
288 SDL_SetColorKey(CGchar, (SDL_SRCCOLORKEY|SDL_RLEACCEL), 0); |
|
289 bg = LCDbg0; |
|
290 |
|
291 sr.x = sr.y = 0; |
|
292 dr.x = x; |
|
293 dr.y = y; |
|
294 sr.w = dr.w = fontwidth; |
|
295 sr.h = dr.h = fontheight; |
|
296 |
|
297 SDL_FillRect(pSdlGuiScrn, &dr, bg); |
|
298 SDL_BlitSurface(CGchar, &sr, pSdlGuiScrn, &dr); |
|
299 SDL_UpdateRect(pSdlGuiScrn, x, y, fontwidth, fontheight); |
|
300 SDL_FreeSurface(CGchar); |
244 } |
301 } |
245 |
302 |
246 |
303 |
247 |
304 |
248 /* |
305 /* |