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