PAlib: PA_Keyboard.h Source File

Main Page | Modules | File List | Globals | Search for

# PA_Keyboard.h

Go to the documentation of this file.

    00001 #ifndef _PA_Keyboard
    00002 #define _PA_Keyboard
    00003
    00004 #ifdef __cplusplus
    00005 extern "C" {
    00006 #endif
    00007
    00008 #include "PA9.h"
    00009
    00010
    00011
    00012
    00021 void PA_SetLetterPal(s16 x, s16 y, u8 Pal);
    00022
    00023
    00025 // Système de Tiles
    00027
    00028
    00029
    00030 extern const unsigned char keyboard_Tiles[10240];
    00031 extern const unsigned short keyboard_Map[4096];
    00032 //extern const unsigned short keyboardPal1[16];
    00033 //extern const unsigned short keyboardPal2[16];
    00034
    00035 typedef struct {
    00036        u8 Bg; // Numéro du fond
    00037        u8 Type; // 0 pour normal, 1 pour majuscules..
    00038        char Letter;  // Lettre
    00039        s16 ScrollX, ScrollY;  // Scroll x et y...
    00040        s16 Repeat;  // Temps avant de répéter...
    00041        s16 oldX, oldY; // Ancienne zone touchée
    00042        u8 Color1, Color2; // Main color, pressed color...
    00043 } Keyboards;
    00044 extern Keyboards Keyboard;
    00045
    00046 extern const u8 PA_Keyboard[2][5][24];
    00047
    00048
    00049
    00050
    00065 void PA_InitKeyboard(u8 bg_number);
    00066
    00067
    00074 char PA_CheckKeyboard(void);
    00075
    00076
    00077
    00087 extern inline void PA_ScrollKeyboardX(s16 x) {
    00088        PA_BGScrollX(0, Keyboard.Bg, -x);
    00089        Keyboard.ScrollX = x;
    00090 }
    00091
    00092
    00102 extern inline void PA_ScrollKeyboardY(s16 y) {
    00103        PA_BGScrollY(0, Keyboard.Bg, -y);
    00104        Keyboard.ScrollY = y;
    00105 }
    00106
    00107
    00120 extern inline void PA_ScrollKeyboardXY(s16 x, s16 y) {
    00121        PA_BGScrollXY(0, Keyboard.Bg, -x, -y);
    00122        Keyboard.ScrollX = x;
    00123        Keyboard.ScrollY = y;
    00124 }
    00125
    00126
    00133 #define PA_EraseLastKey() PA_SetLetterPal(Keyboard.oldX, Keyboard.oldY, 15)
    00134
    00135
    00148 extern inline void PA_KeyboardIn(s16 x, s16 y){  // Faire rentrer le clavier...
    00149 s16 i;
    00150        PA_ScrollKeyboardXY(x, 192);  // On le sort et met en X. Puis on fait glisser...
    00151        for (i = 192; i > y; i-=8){
    00152               PA_ScrollKeyboardY(i);
    00153               PA_WaitForVBL();
    00154        }
    00155        PA_ScrollKeyboardY(y);  // On amène pile au bon y...
    00156 }
    00157
    00158
    00165 extern inline void PA_KeyboardOut(void){  // Faire sortir le clavier...
    00166 s16 i;
    00167 PA_EraseLastKey(); // Efface s'il reste une touche pressée...
    00168        for (i = Keyboard.ScrollY; i < 200; i+=8){
    00169               PA_ScrollKeyboardY(i);
    00170               PA_WaitForVBL();
    00171        }
    00172 }
    00173
    00174
    00175
    00176
    00183 void PA_ReloadKeyboardCol(void);
    00184
    00185
    00198 extern inline void PA_SetKeyboardColor(u8 color1, u8 color2){
    00199        Keyboard.Color1 = color1;
    00200        Keyboard.Color2 = color2;
    00201        PA_ReloadKeyboardCol();
    00202 }
    00203
    00204  // end of Keyboard
    00206
    00207 #ifdef __cplusplus
    00208 }
    00209 #endif
    00210
    00211 #endif
    00212
    00213