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
    00006 #define PA_InitCustomTextEx(screen, bg_select, tiles, map, pal) {\
    00007    PAbgtext[screen] = bg_select;\
    00008    PA_LoadSimpleBg(screen, bg_select, tiles, Blank, BG_256X256, 0, 1);\
    00009    PA_LoadBgPal(screen, bg_select, (void*)pal);\
    00010    PA_textmap[screen] = (u16*)map;PA_textpal[screen] = (u16*)pal;PAtext_pal[screen]=0;\
    00011    u32 PAtexttempvar = 0; for (PAtexttempvar = 0; PAtexttempvar < 32*24; PAtexttempvar++) PA_SetTileLetter(screen, PAtexttempvar, 0, 0);   }
    00012
    00013 void PA_CreateTextPal(bool screen, u8 pal_number, u16 r, u16 g, u16 b);
    00014
    00015
    00022 //#include "../PA.h"
    00023 #include "PA_Tile.h"
    00024
    00025 #include "../../../lib/arm9/PA/Text/all_gfx.h" // Include the text !
    00026
    00027
    00029 // Système pour le texte
    00031
    00032
    00033 extern u16 textcol[2]; // Garde en mémoire la couleur du texte
    00034 extern u8 PAbgtext[2];
    00035
    00036
    00037 extern u16 *PA_textmap[2]; //Pointeur vers la map et les tiles...
    00038 extern u8 *PA_texttiles[2];
    00039 extern u16 *PA_textpal[2];
    00040
    00041 extern s8 PA_font[2];  // 0 pour normal, 1 pour dégradé, -1 pour custom
    00042
    00043
    00044
    00045
    00046 // Texte à taille variable
    00047 #ifdef TEXT_ALLSIZES
    00048        #include "text0.h" // La police à taille variable...
    00049        #include "text1.h" // La police à taille variable...
    00050        #include "text2.h" // La police à taille variable...
    00051        #include "text3.h" // La police à taille variable...
    00052        #include "text4.h" // La police à taille variable...
    00053        extern const u8 *textData[5];
    00054        extern const u8 policeheight[5];
    00055        extern const u16 policewidth[5];
    00056        extern const u8 policesize[5][256];
    00057 #endif
    00058
    00059
    00060 typedef void(*letterfp)(u8 size, bool screen, u16 x, u16 y, char lettertemp, u8 color);
    00061
    00062
    00063
    00064
    00065 extern letterfp letters[5];
    00066
    00067
    00068 extern u16 PAtext_pal[2];
    00069
    00070
    00071 typedef struct{
    00072        u8 x1, x2, y1, y2;
    00073 } textborders;
    00074 extern textborders PA_TextBox[2];
    00075
    00076
    00077
    00078
    00079
    00099 void PA_InitText(bool screen, u8 bg_select);
    00100
    00101
    00119 extern inline void PA_SetTileLetter(bool screen, u16 x, u16 y, char letter) {
    00120        PA_SetMapTileAll(screen, PAbgtext[screen], x, y, (PA_textmap[screen][(u16)letter]&((1<<12)-1)) + (PAtext_pal[screen] << 12));
    00121 }
    00122
    00123
    00135 extern inline void PA_SetTextTileCol(bool screen, u8 color)
    00136 {
    00137        PAtext_pal[screen] = color;
    00138 }
    00139
    00140
    00141
    00142
    00160 void PA_OutputText(bool screen, u16 x, u16 y, char* text, ...);
    00161
    00179 u16 PA_OutputSimpleText(bool screen, u16 x, u16 y, const char *text);
    00180
    00207 u32 PA_BoxText(bool screen, u16 basex, u16 basey, u16 maxx, u16 maxy, const char *text, u32 limit);
    00208
    00235 u32 PA_BoxTextNoWrap(bool screen, u16 basex, u16 basey, u16 maxx, u16 maxy, const char *text, u32 limit);
    00236
    00237
    00256 extern inline void PA_SetTextCol(bool screen, u16 r, u16 g, u16 b){
    00257        PA_CreateTextPal(screen, 0, r, g, b);
    00258 }
    00259
    00260
    00261
    00262 //void PA_InitCustomTextEx(bool screen, u8 bg_select, void *tiles, void *map, void *pal);
    00263
    00264
    00281 #define PA_InitCustomText(screen, bg_select, text) PA_InitCustomTextEx(screen, bg_select, text##_Tiles, text##_Map, text##_Pal)
    00282
    00292 #define PA_ShowFont(screen) PA_LoadBgMap(screen, PAbgtext[screen], (void*)PA_textmap[screen], BG_256X256)
    00293
    00294
    00295
    00296
    00297
    00333 s16 PA_SmartText(bool screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char* text, u8 color, u8 size, u8 transp,  s32 limit);
    00334
    00335
    00336
    00369 s16 PA_CenterSmartText(bool screen, s16 basex, s16 basey, s16 maxx, s16 maxy, char* text, u8 color, u8 size, u8 transp);
    00370
    00371
    00372
    00384 extern inline bool PA_CompareText(char *text1, char *text2){
    00385        bool ok = 1; // Devrait etre bon
    00386        u8 i = 0;
    00387        while(ok && text2[i]){
    00388               if (text1[i] != text2[i]) ok = 0;
    00389               i++;
    00390        }
    00391        return ok;
    00392 }
    00393
    00394
    00406 extern inline void PA_CopyText(char *text1, char *text2){
    00407 u8 i = 0;
    00408 text1[i] = text2[i];
    00409        do{
    00410               i++;
    00411               text1[i] = text2[i];
    00412        }
    00413        while (text2[i]);
    00414 }
    00415
    00416
    00417
    00418
    00439 void PA_InitTextBorders(bool screen, u8 x1, u8 y1, u8 x2, u8 y2);
    00440
    00441
    00450 void PA_EraseTextBox(bool screen);
    00451
    00452
    00453
    00468 extern inline u32 PA_SimpleBoxText(bool screen, const char *text, u32 limit){
    00469 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);
    00470 }
    00471
    00480 extern inline void PA_ClearTextBg(bool screen){
    00481 u8 i, j;
    00482 for (i = 0; i < 32; i++) for (j = 0; j < 32; j++) PA_SetMapTileAll(screen, PAbgtext[screen], i, j, 0);
    00483 }
    00484
    00485
    00486
    00487 void PA_OutputTextSpecial0(bool screen, int x1, int y,char *text);
    00488 void PA_OutputTextSpecial1(bool screen, int x1, int y,char *text);
    00489 void PA_OutputTextSpecial2(bool screen, int x1, int y,char *text);
    00490 void PA_OutputTextSpecial3(bool screen, int x1, int y,char *text);
    00491 void PA_OutputTextSpecial4(bool screen, int x1, int y,char *text);
    00492 void PA_OutputTextSpecial5(bool screen, int x1, int y,char *text);
    00493  // end of Text
    00495
    00496
    00497 #endif
    00498
    00499
    00500