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 #define PA_BACKSPACE 1    // On va dire que la touche backspace a pour valeur 1...
00049 #define PA_CAPS      2    // 2 pour CAPS
00050 #define PA_ENTER     '\n'    // 3 pour Enter
00051 #define PA_SHIFT     4    // etc
00052 #define PA_RIEN      0    // Si y'a rien, faudra faire comme si on appuye sur rien
00053 #define PA_TAB       3    // tab...
00054 
00055 
00056 
00057 
00072 void PA_InitKeyboard(u8 bg_number);
00073 
00074 
00081 char PA_CheckKeyboard(void);
00082 
00083 
00084 
00094 extern inline void PA_ScrollKeyboardX(s16 x) {
00095        PA_BGScrollX(0, Keyboard.Bg, -x);
00096        Keyboard.ScrollX = x;
00097 }
00098 
00099 
00109 extern inline void PA_ScrollKeyboardY(s16 y) {
00110        PA_BGScrollY(0, Keyboard.Bg, -y);
00111        Keyboard.ScrollY = y;
00112 }
00113 
00114 
00127 extern inline void PA_ScrollKeyboardXY(s16 x, s16 y) {
00128        PA_BGScrollXY(0, Keyboard.Bg, -x, -y);
00129        Keyboard.ScrollX = x;
00130        Keyboard.ScrollY = y;
00131 }
00132 
00133 
00140 #define PA_EraseLastKey() PA_SetLetterPal(Keyboard.oldX, Keyboard.oldY, 15)
00141 
00142 
00155 extern inline void PA_KeyboardIn(s16 x, s16 y){  // Faire rentrer le clavier... 
00156 s16 i;
00157        PA_ScrollKeyboardXY(x, 192);  // On le sort et met en X. Puis on fait glisser...
00158        for (i = 192; i > y; i-=8){
00159               PA_ScrollKeyboardY(i);
00160               PA_WaitForVBL();
00161        }
00162        PA_ScrollKeyboardY(y);  // On amène pile au bon y...           
00163 }
00164 
00165 
00172 extern inline void PA_KeyboardOut(void){  // Faire sortir le clavier... 
00173 s16 i;
00174 PA_EraseLastKey(); // Efface s'il reste une touche pressée...
00175        for (i = Keyboard.ScrollY; i < 200; i+=8){
00176               PA_ScrollKeyboardY(i);
00177               PA_WaitForVBL();
00178        }
00179 }
00180 
00181 
00182 
00183 
00190 void PA_ReloadKeyboardCol(void);
00191 
00192 
00205 extern inline void PA_SetKeyboardColor(u8 color1, u8 color2){
00206        Keyboard.Color1 = color1;
00207        Keyboard.Color2 = color2;
00208        PA_ReloadKeyboardCol();
00209 }
00210 
00211  // end of Keyboard
00213 
00214 #ifdef __cplusplus
00215 }
00216 #endif
00217 
00218 #endif
00219 
00220 

Generated on Sun Jan 22 11:46:39 2006 for PAlib by  doxygen 1.3.9.1