--- np2/generic/cmndraw.c 2003/11/21 06:51:11 1.1 +++ np2/generic/cmndraw.c 2004/03/10 02:42:51 1.3 @@ -1,8 +1,34 @@ #include "compiler.h" #include "scrnmng.h" +#include "cpucore.h" +#include "font.h" #include "cmndraw.h" +void cmndraw_getpals(CMNPALFN *fn, CMNPAL *pal, UINT pals) { + + UINT i; + + if (fn == NULL) { + return; + } + if (fn->get8) { + for (i=0; iget8)(fn, i); + } + } + if (fn->get32) { + for (i=0; iget32)(fn, i); + } + if (fn->cnv16) { + for (i=0; icnv16)(fn, pal[i].pal32); + } + } + } +} + void cmndraw_makegrad(RGB32 *pal, int pals, RGB32 bg, RGB32 fg) { int i; @@ -396,3 +422,75 @@ const BYTE *p; } #endif + + +// ---- + +void cmddraw_fill(CMNVRAM *vram, int x, int y, int cx, int cy, CMNPAL *pal) { + + if ((vram == NULL) || (pal == NULL)) { + return; + } + switch(vram->bpp) { +#if defined(SUPPORT_8BPP) + case 8: + cmndraw8_fill(vram, x, y, cx, cy, pal->pal8); + break; +#endif +#if defined(SUPPORT_16BPP) + case 16: + cmndraw16_fill(vram, x, y, cx, cy, pal->pal16); + break; +#endif +#if defined(SUPPORT_24BPP) + case 24: + cmndraw24_fill(vram, x, y, cx, cy, pal->pal32); + break; +#endif +#if defined(SUPPORT_32BPP) + case 32: + cmndraw32_fill(vram, x, y, cx, cy, pal->pal32); + break; +#endif + } +} + +void cmddraw_text8(CMNVRAM *vram, int x, int y, const char *str, CMNPAL *pal) { + + UINT s; + BYTE src[10]; + + if ((vram == NULL) || (str == NULL) || (pal == NULL)) { + return; + } + src[0] = 8; + src[1] = 8; + while(*str) { + s = (UINT)(*str++); + CopyMemory(src + 2, fontrom + 0x82000 + (s * 16), 8); + 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 += 8; + } +} +