|
|
| version 1.2, 2004/03/09 23:39:19 | version 1.4, 2004/03/10 07:41:48 |
|---|---|
| Line 1 | Line 1 |
| #include "compiler.h" | #include "compiler.h" |
| #include "scrnmng.h" | #include "scrnmng.h" |
| #include "cpucore.h" | |
| #include "font.h" | |
| #include "cmndraw.h" | #include "cmndraw.h" |
| #include "minifont.res" | |
| void cmndraw_getpals(CMNPALFN *fn, CMNPAL *pal, UINT pals) { | void cmndraw_getpals(CMNPALFN *fn, CMNPAL *pal, UINT pals) { |
| Line 453 void cmddraw_fill(CMNVRAM *vram, int x, | Line 456 void cmddraw_fill(CMNVRAM *vram, int x, |
| } | } |
| } | } |
| void cmddraw_text8(CMNVRAM *vram, int x, int y, const char *str, CMNPAL *pal) { | |
| UINT s; | |
| const BYTE *ptr; | |
| BYTE src[10]; | |
| if ((vram == NULL) || (str == NULL) || (pal == NULL)) { | |
| return; | |
| } | |
| src[0] = 0; | |
| src[1] = 7; | |
| while(*str) { | |
| s = (UINT)(*str++); | |
| ptr = NULL; | |
| if ((s >= 0x20) && (s < 0x80)) { | |
| ptr = minifont + (s - 0x20) * 8; | |
| } | |
| else if ((s >= 0xa0) && (s < 0xe0)) { | |
| ptr = minifont + (s - 0xa0 + 0x60) * 8; | |
| } | |
| if (ptr == NULL) { | |
| continue; | |
| } | |
| src[0] = ptr[0]; | |
| CopyMemory(src + 2, ptr + 1, 7); | |
| switch(vram->bpp) { | |
| #if defined(SUPPORT_8BPP) | |
| case 8: | |
| cmndraw8_setfg(vram, src, x, y, pal->pal8); | |
| break; | |
| #endif | |
| #if defined(SUPPORT_16BPP) | |
| case 16: | |
| cmndraw16_setfg(vram, src, x, y, pal->pal16); | |
| break; | |
| #endif | |
| #if defined(SUPPORT_24BPP) | |
| case 24: | |
| cmndraw24_setfg(vram, src, x, y, pal->pal32); | |
| break; | |
| #endif | |
| #if defined(SUPPORT_32BPP) | |
| case 32: | |
| cmndraw32_setfg(vram, src, x, y, pal->pal32); | |
| break; | |
| #endif | |
| } | |
| x += ptr[0] + 1; | |
| } | |
| } | |