PAlib: Fichier source de PA_16c.h

Page principale | Modules | Liste des fichiers | Portée globale | Rechercher

# PA_16c.h

Aller à la documentation de ce fichier.

    00001 #ifndef _PA_16C
    00002 #define _PA_16C
    00003
    00004 #ifdef __cplusplus
    00005 extern "C" {
    00006 #endif
    00007
    00014 #include "PA9.h"
    00015
    00016 #include "PA_Palette.h"
    00017
    00018
    00019 // Pointers...
    00020 extern u16 *PA_Draw16[2];
    00021 extern u32 *PA_Draw1632[2];
    00022
    00023 extern u32 Blank[130000>>2];
    00024
    00025
    00026 #define PA_LoadPal16c(palette, source)   DMA_Copy(source, (void*)palette, 16, DMA_16NOW);
    00027 #define PA_16cPos(x, y) (((x>>3)*26*8) + y + 8)
    00028
    00029 #ifdef USE_16cTEXT
    00030        extern const u8 c16_policeheight[5];
    00031        extern const u8 c16_policesize[5][96];
    00032        extern u32 *c16_font[5];
    00033 #endif
    00034
    00035 ALWAYSINLINE void PA_Plot8Pixels(u8 screen, u16 pos, u16 temp, u32 color){
    00036    PA_Draw1632[screen][pos] |= (color<<temp);
    00037    PA_Draw1632[screen][pos+(26*8)] |= (color>>(32-temp));
    00038 }
    00039
    00040 ALWAYSINLINE void PA_16c16X16Letter(u8 screen, s16 x, s16 y, u32 *image, u8 color){
    00041
    00042    x += 8; y += 8;
    00043
    00044    u16 temp = (x&7)<<2;
    00045    u16 pos = PA_16cPos(x, y);
    00046    u8 i;
    00047    for (i = 0; i < 2; i++){
    00048           PA_Plot8Pixels(screen, pos, temp, image[0]*color);
    00049           PA_Plot8Pixels(screen, pos+1, temp, image[1]*color);
    00050           PA_Plot8Pixels(screen, pos+2, temp, image[2]*color);
    00051           PA_Plot8Pixels(screen, pos+3, temp, image[3]*color);
    00052           PA_Plot8Pixels(screen, pos+4, temp, image[4]*color);
    00053           PA_Plot8Pixels(screen, pos+5, temp, image[5]*color);
    00054           PA_Plot8Pixels(screen, pos+6, temp, image[6]*color);
    00055           PA_Plot8Pixels(screen, pos+7, temp, image[7]*color);
    00056           PA_Plot8Pixels(screen, pos+8, temp, image[16]*color);
    00057           PA_Plot8Pixels(screen, pos+9, temp, image[17]*color);
    00058           PA_Plot8Pixels(screen, pos+10, temp, image[18]*color);
    00059           PA_Plot8Pixels(screen, pos+11, temp, image[19]*color);
    00060           PA_Plot8Pixels(screen, pos+12, temp, image[20]*color);
    00061           PA_Plot8Pixels(screen, pos+13, temp, image[21]*color);
    00062           PA_Plot8Pixels(screen, pos+14, temp, image[22]*color);
    00063           PA_Plot8Pixels(screen, pos+15, temp, image[23]*color);
    00064           pos+=26*8;
    00065           image+=8;
    00066        }
    00067 }
    00068 ALWAYSINLINE void PA_16c8X8Letter(u8 screen, s16 x, s16 y, u32 *image, u8 color){
    00069    x += 8; y += 8;
    00070    u16 temp = (x&7)<<2;
    00071    u16 pos = PA_16cPos(x, y);
    00072    PA_Draw1632[screen][pos] |= (image[0]<<temp)*color;
    00073    PA_Draw1632[screen][pos+1] |= (image[1]<<temp)*color;
    00074    PA_Draw1632[screen][pos+2] |= (image[2]<<temp)*color;
    00075    PA_Draw1632[screen][pos+3] |= (image[3]<<temp)*color;
    00076    PA_Draw1632[screen][pos+4] |= (image[4]<<temp)*color;
    00077    PA_Draw1632[screen][pos+5] |= (image[5]<<temp)*color;
    00078    PA_Draw1632[screen][pos+6] |= (image[6]<<temp)*color;
    00079    PA_Draw1632[screen][pos+7] |= (image[7]<<temp)*color;
    00080    pos += (26*8); // Next columns
    00081    temp = 32-temp;
    00082    PA_Draw1632[screen][pos] |= (image[0]>>temp)*color;
    00083    PA_Draw1632[screen][pos+1] |= (image[1]>>temp)*color;
    00084    PA_Draw1632[screen][pos+2] |= (image[2]>>temp)*color;
    00085    PA_Draw1632[screen][pos+3] |= (image[3]>>temp)*color;
    00086    PA_Draw1632[screen][pos+4] |= (image[4]>>temp)*color;
    00087    PA_Draw1632[screen][pos+5] |= (image[5]>>temp)*color;
    00088    PA_Draw1632[screen][pos+6] |= (image[6]>>temp)*color;
    00089    PA_Draw1632[screen][pos+7] |= (image[7]>>temp)*color;
    00090 }
    00091
    00092
    00114 void PA_Init16cBgEx(u8 screen, u8 bg, u8 npalette);
    00115
    00116
    00117
    00129 extern inline void PA_Init16cBg(u8 screen, u8 bg){
    00130        PA_Init16cBgEx(screen, bg, 0);
    00131 }
    00132
    00133
    00134
    00135
    00136
    00145 extern inline void PA_16cErase(u8 screen){
    00146        DMA_Copy(Blank, PA_Draw1632[screen], 26*8*34, DMA_32NOW)
    00147 }
    00148
    00149
    00150
    00156 extern inline void PA_Dual16cErase(void){
    00157        PA_16cErase(0); PA_16cErase(1);
    00158 }
    00159
    00160
    00172 extern inline void PA_InitComplete16c(u8 bg, void *Palette){
    00173        PA_LoadPal16c(PAL_BG0, Palette);
    00174        PA_LoadPal16c(PAL_BG1, Palette);
    00175        PA_Init16cBg(0, bg); PA_Init16cBg(1, bg);
    00176 }
    00177
    00178
    00179
    00180
    00181
    00182 s16 PA_16cText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char* text, u8 color, u8 size, s32 limit);
    00183
    00184
    00185
    00186
    00187
    00205 ALWAYSINLINE void PA_16c8X4(u8 screen, s16 x, s16 y, u32 *image){
    00206    x += 8; y += 8;
    00207    u16 temp = (x&7)<<2;
    00208    u16 pos = PA_16cPos(x, y);
    00209    PA_Draw1632[screen][pos] |= (image[0]<<temp);
    00210    PA_Draw1632[screen][pos+1] |= (image[1]<<temp);
    00211    PA_Draw1632[screen][pos+2] |= (image[2]<<temp);
    00212    PA_Draw1632[screen][pos+3] |= (image[3]<<temp);
    00213    pos += (26*8); // Next columns
    00214    temp = 32-temp;
    00215    PA_Draw1632[screen][pos] |= (image[0]>>temp);
    00216    PA_Draw1632[screen][pos+1] |= (image[1]>>temp);
    00217    PA_Draw1632[screen][pos+2] |= (image[2]>>temp);
    00218    PA_Draw1632[screen][pos+3] |= (image[3]>>temp);
    00219 }
    00220
    00221
    00239 ALWAYSINLINE void PA_16c8X6(u8 screen, s16 x, s16 y, u32 *image){
    00240
    00241    x += 8; y += 8;
    00242    u16 temp = (x&7)<<2;
    00243    u16 pos = PA_16cPos(x, y);
    00244    PA_Plot8Pixels(screen, pos, temp, image[0]);
    00245    PA_Plot8Pixels(screen, pos+1, temp, image[1]);
    00246    PA_Plot8Pixels(screen, pos+2, temp, image[2]);
    00247    PA_Plot8Pixels(screen, pos+3, temp, image[3]);
    00248    PA_Plot8Pixels(screen, pos+4, temp, image[4]);
    00249    PA_Plot8Pixels(screen, pos+5, temp, image[5]);
    00250 }
    00251
    00252
    00270 ALWAYSINLINE void PA_16c8X8(u8 screen, s16 x, s16 y, u32 *image){
    00271    x += 8; y += 8;
    00272    u16 temp = (x&7)<<2;
    00273    u16 pos = PA_16cPos(x, y);
    00274    PA_Draw1632[screen][pos] |= (image[0]<<temp);
    00275    PA_Draw1632[screen][pos+1] |= (image[1]<<temp);
    00276    PA_Draw1632[screen][pos+2] |= (image[2]<<temp);
    00277    PA_Draw1632[screen][pos+3] |= (image[3]<<temp);
    00278    PA_Draw1632[screen][pos+4] |= (image[4]<<temp);
    00279    PA_Draw1632[screen][pos+5] |= (image[5]<<temp);
    00280    PA_Draw1632[screen][pos+6] |= (image[6]<<temp);
    00281    PA_Draw1632[screen][pos+7] |= (image[7]<<temp);
    00282    pos += (26*8); // Next columns
    00283    temp = 32-temp;
    00284    PA_Draw1632[screen][pos] |= (image[0]>>temp);
    00285    PA_Draw1632[screen][pos+1] |= (image[1]>>temp);
    00286    PA_Draw1632[screen][pos+2] |= (image[2]>>temp);
    00287    PA_Draw1632[screen][pos+3] |= (image[3]>>temp);
    00288    PA_Draw1632[screen][pos+4] |= (image[4]>>temp);
    00289    PA_Draw1632[screen][pos+5] |= (image[5]>>temp);
    00290    PA_Draw1632[screen][pos+6] |= (image[6]>>temp);
    00291    PA_Draw1632[screen][pos+7] |= (image[7]>>temp);
    00292 }
    00293
    00294
    00295
    00296 ALWAYSINLINE void PA_16c16X8(u8 screen, s16 x, s16 y, u32 *image){
    00297    x += 8; y += 8;
    00298    u16 temp = (x&7)<<2;
    00299    u16 pos = PA_16cPos(x, y);
    00300    u8 i;
    00301    for (i = 0; i < 2; i++){
    00302           PA_Plot8Pixels(screen, pos, temp, image[0]);
    00303           PA_Plot8Pixels(screen, pos+1, temp, image[1]);
    00304           PA_Plot8Pixels(screen, pos+2, temp, image[2]);
    00305           PA_Plot8Pixels(screen, pos+3, temp, image[3]);
    00306           PA_Plot8Pixels(screen, pos+4, temp, image[4]);
    00307           PA_Plot8Pixels(screen, pos+5, temp, image[5]);
    00308           PA_Plot8Pixels(screen, pos+6, temp, image[6]);
    00309           PA_Plot8Pixels(screen, pos+7, temp, image[7]);
    00310           pos+=26*8;
    00311           image+=8;
    00312        }
    00313 }
    00314
    00315
    00316
    00317 ALWAYSINLINE void PA_16c16X12(u8 screen, s16 x, s16 y, u32 *image){
    00318
    00319    x += 8; y += 8;
    00320    u16 temp = (x&7)<<2;
    00321    u16 pos = PA_16cPos(x, y);
    00322    u8 i;
    00323    for (i = 0; i < 2; i++){
    00324           PA_Plot8Pixels(screen, pos, temp, image[0]);
    00325           PA_Plot8Pixels(screen, pos+1, temp, image[1]);
    00326           PA_Plot8Pixels(screen, pos+2, temp, image[2]);
    00327           PA_Plot8Pixels(screen, pos+3, temp, image[3]);
    00328           PA_Plot8Pixels(screen, pos+4, temp, image[4]);
    00329           PA_Plot8Pixels(screen, pos+5, temp, image[5]);
    00330           PA_Plot8Pixels(screen, pos+6, temp, image[6]);
    00331           PA_Plot8Pixels(screen, pos+7, temp, image[7]);
    00332           PA_Plot8Pixels(screen, pos+8, temp, image[16]);
    00333           PA_Plot8Pixels(screen, pos+9, temp, image[17]);
    00334           PA_Plot8Pixels(screen, pos+10, temp, image[18]);
    00335           PA_Plot8Pixels(screen, pos+11, temp, image[19]);
    00336           pos+=26*8;
    00337           image+=8;
    00338        }
    00339 }
    00340
    00341 ALWAYSINLINE void PA_16c16X16(u8 screen, s16 x, s16 y, u32 *image){
    00342
    00343    x += 8; y += 8;
    00344
    00345    u16 temp = (x&7)<<2;
    00346    u16 pos = PA_16cPos(x, y);
    00347    u8 i;
    00348    for (i = 0; i < 2; i++){
    00349           PA_Plot8Pixels(screen, pos, temp, image[0]);
    00350           PA_Plot8Pixels(screen, pos+1, temp, image[1]);
    00351           PA_Plot8Pixels(screen, pos+2, temp, image[2]);
    00352           PA_Plot8Pixels(screen, pos+3, temp, image[3]);
    00353           PA_Plot8Pixels(screen, pos+4, temp, image[4]);
    00354           PA_Plot8Pixels(screen, pos+5, temp, image[5]);
    00355           PA_Plot8Pixels(screen, pos+6, temp, image[6]);
    00356           PA_Plot8Pixels(screen, pos+7, temp, image[7]);
    00357           PA_Plot8Pixels(screen, pos+8, temp, image[16]);
    00358           PA_Plot8Pixels(screen, pos+9, temp, image[17]);
    00359           PA_Plot8Pixels(screen, pos+10, temp, image[18]);
    00360           PA_Plot8Pixels(screen, pos+11, temp, image[19]);
    00361           PA_Plot8Pixels(screen, pos+12, temp, image[20]);
    00362           PA_Plot8Pixels(screen, pos+13, temp, image[21]);
    00363           PA_Plot8Pixels(screen, pos+14, temp, image[22]);
    00364           PA_Plot8Pixels(screen, pos+15, temp, image[23]);
    00365           pos+=26*8;
    00366           image+=8;
    00367        }
    00368 }
    00369
    00370
    00371 #ifdef USE_16cTEXT
    00372
    00373 extern inline void PA_16cLetter(u8 screen, s16 x, s16 y, char letter, u8 size, u8 color){
    00374        if (c16_policeheight[size]<=8) PA_16c8X8Letter(screen, x, y, (u32*)(c16_font[size]+(letter<<3)), color);
    00375        else PA_16c16X16Letter(screen, x, y, (u32*)(c16_font[size]+(letter<<5)), color);
    00376 }
    00377 #endif
    00378
    00379
    00380  // end of 16c
    00382
    00383
    00384
    00385
    00386 #ifdef __cplusplus
    00387 }
    00388 #endif
    00389
    00390
    00391
    00392
    00393
    00394
    00395
    00396
    00397 #endif
    00398
    00399
    00400
    00401