PAlib: Fichier source de PA_Text.h

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

# PA_Text.h

Aller à la documentation de ce fichier.

    00001 #ifndef _PA_TEXT
    00002 #define _PA_TEXT
    00003
    00004
    00005 #ifdef __cplusplus
    00006 extern "C" {
    00007 #endif
    00008
    00009 #include "PA_BgTiles.h"
    00010 #include "../../../lib/arm9/PA/Text/all_gfx.h" // Include the text !
    00011
    00012
    00013 #define PA_InitCustomTextEx(screen, bg_select, tiles, map, pal) {\
    00014    PAbgtext[screen] = bg_select;\
    00015    PA_LoadSimpleBg(screen, bg_select, tiles, Blank, BG_256X256, 0, 1);\
    00016    PA_LoadBgPal(screen, bg_select, (void*)pal);\
    00017    PA_textmap[screen] = (u16*)map;PA_textpal[screen] = (u16*)pal;PAtext_pal[screen]=0;\
    00018    u32 PAtexttempvar = 0; for (PAtexttempvar = 0; PAtexttempvar < 32*24; PAtexttempvar++) PA_SetTileLetter(screen, PAtexttempvar, 0, 0);   }
    00019
    00020 void PA_CreateTextPal(u8 screen, u8 pal_number, u16 r, u16 g, u16 b);
    00021
    00022
    00029 //#include "../PA.h"
    00030
    00031
    00032
    00033
    00035 // Système pour le texte
    00037
    00038
    00039 extern u16 textcol[2]; // Garde en mémoire la couleur du texte
    00040 extern u8 PAbgtext[2];
    00041
    00042
    00043 extern u16 *PA_textmap[2]; //Pointeur vers la map et les tiles...
    00044 extern u8 *PA_texttiles[2];
    00045 extern u16 *PA_textpal[2];
    00046
    00047 extern s8 PA_font[2];  // 0 pour normal, 1 pour dégradé, -1 pour custom
    00048
    00049
    00050
    00051
    00052 // Texte à taille variable
    00053 //#ifdef TEXT_ALLSIZES
    00054        #include "text0.h" // La police à taille variable...
    00055        #include "text1.h" // La police à taille variable...
    00056        #include "text2.h" // La police à taille variable...
    00057        #include "text3.h" // La police à taille variable...
    00058        #include "text4.h" // La police à taille variable...
    00059        extern const u8 *textData[5];
    00060        extern const u8 policeheight[5];
    00061        extern const u16 policewidth[5];
    00062        extern const u8 policesize[5][256];
    00063 //#endif
    00064
    00065
    00066 typedef void(*letterfp)(u8 size, u8 screen, u16 x, u16 y, char lettertemp, u8 color);
    00067
    00068
    00069
    00070
    00071 extern letterfp letters[5];
    00072
    00073
    00074 extern u16 PAtext_pal[2];
    00075
    00076
    00077 typedef struct{
    00078        u8 x1, x2, y1, y2;
    00079 } textborders;
    00080 extern textborders PA_TextBox[2];
    00081
    00082
    00083
    00084
    00085
    00105 void PA_InitText(u8 screen, u8 bg_select);
    00106
    00107
    00125 #define PA_SetTileLetter(screen, x, y, letter) PA_SetMapTileAll(screen, PAbgtext[screen], x, y, (PA_textmap[screen][(u16)letter]&((1<<12)-1)) + (PAtext_pal[screen] << 12))
    00126
    00127
    00128
    00140 extern inline void PA_SetTextTileCol(u8 screen, u8 color)
    00141 {
    00142        PAtext_pal[screen] = color;
    00143 }
    00144
    00145
    00146
    00147
    00165 void PA_OutputText(u8 screen, u16 x, u16 y, char* text, ...);
    00166
    00184 u16 PA_OutputSimpleText(u8 screen, u16 x, u16 y, const char *text);
    00185
    00212 u32 PA_BoxText(u8 screen, u16 basex, u16 basey, u16 maxx, u16 maxy, const char *text, s32 limit);
    00213
    00240 u32 PA_BoxTextNoWrap(u8 screen, u16 basex, u16 basey, u16 maxx, u16 maxy, const char *text, u32 limit);
    00241
    00242
    00261 extern inline void PA_SetTextCol(u8 screen, u16 r, u16 g, u16 b){
    00262        PA_CreateTextPal(screen, 0, r, g, b);
    00263 }
    00264
    00265
    00266
    00267 //void PA_InitCustomTextEx(u8 screen, u8 bg_select, void *tiles, void *map, void *pal);
    00268
    00269
    00286 #define PA_InitCustomText(screen, bg_select, text) PA_InitCustomTextEx(screen, bg_select, text##_Tiles, text##_Map, text##_Pal)
    00287
    00297 #define PA_ShowFont(screen) PA_LoadBgMap(screen, PAbgtext[screen], (void*)PA_textmap[screen], BG_256X256)
    00298
    00299
    00300
    00301
    00302
    00338 s16 PA_SmartText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char* text, u8 color, u8 size, u8 transp,  s32 limit);
    00339
    00340
    00341
    00374 s16 PA_CenterSmartText(u8 screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char* text, u8 color, u8 size, u8 transp);
    00375
    00376
    00377 /*
    00389 extern inline u8 PA_CompareText(char *text1, char *text2){
    00390        u8 ok = 1; // Devrait etre bon
    00391        u8 i = 0;
    00392        while(ok && text2[i]){
    00393               if (text1[i] != text2[i]) ok = 0;
    00394               i++;
    00395        }
    00396        return ok;
    00397 }*/
    00398
    00399
    00411 extern inline void PA_CopyText(char *text1, char *text2){
    00412 u8 i = 0;
    00413 text1[i] = text2[i];
    00414        do{
    00415               i++;
    00416               text1[i] = text2[i];
    00417        }
    00418        while (text2[i]);
    00419 }
    00420
    00421
    00422
    00423
    00444 void PA_InitTextBorders(u8 screen, u8 x1, u8 y1, u8 x2, u8 y2);
    00445
    00446
    00455 void PA_EraseTextBox(u8 screen);
    00456
    00457
    00458
    00473 extern inline u32 PA_SimpleBoxText(u8 screen, const char *text, u32 limit){
    00474 return PA_BoxText(screen, PA_TextBox[screen].x1+1, PA_TextBox[screen].y1+1, PA_TextBox[screen].x2-1, PA_TextBox[screen].y2-1, text, limit);
    00475 }
    00476
    00485 extern inline void PA_ClearTextBg(u8 screen){
    00486 u8 i, j;
    00487 for (i = 0; i < 32; i++) for (j = 0; j < 32; j++) PA_SetMapTileAll(screen, PAbgtext[screen], i, j, 0);
    00488 }
    00489
    00490
    00491
    00492 void PA_OutputTextSpecial0(u8 screen, int x1, int y,char *text);
    00493 void PA_OutputTextSpecial1(u8 screen, int x1, int y,char *text);
    00494 void PA_OutputTextSpecial2(u8 screen, int x1, int y,char *text);
    00495 void PA_OutputTextSpecial3(u8 screen, int x1, int y,char *text);
    00496 void PA_OutputTextSpecial4(u8 screen, int x1, int y,char *text);
    00497 void PA_OutputTextSpecial5(u8 screen, int x1, int y,char *text);
    00498  // end of Text
    00500
    00501
    00502 #ifdef __cplusplus
    00503 }
    00504 #endif
    00505
    00506
    00507
    00508 #endif
    00509
    00510
    00511