head 1.1; branch 1.1.1; access ; symbols start:1.1.1.1 PAlibDoc:1.1.1; locks ; strict; comment @# @; 1.1 date 2005.11.02.08.30.22; author jandujar; state Exp; branches 1.1.1.1; next ; 1.1.1.1 date 2005.11.02.08.30.22; author jandujar; state Exp; branches ; next ; desc @@ 1.1 log @Initial revision @ text @ PA_lib: PA_Keyboard.h Source File

PA_Keyboard.h

Go to the documentation of this file.
00001 #ifndef _PA_Keyboard
00002 #define _PA_Keyboard
00003 
00004 
00005 #include "PA9.h"
00006 
00007 
00008 
00009 
00018 void PA_SetLetterPal(s16 x, s16 y, u8 Pal);
00019 
00020 
00022 // Système de Tiles
00024 
00025 
00026 
00027 extern const unsigned char keyboard_Tiles[7264];
00028 extern const unsigned short keyboard_Map[4096];
00029 extern const unsigned short keyboardPal1[16];
00030 extern const unsigned short keyboardPal2[16];
00031 
00032 typedef struct {
00033        u8 Bg; // Numéro du fond
00034        u8 Type; // 0 pour normal, 1 pour majuscules..
00035        char Letter;  // Lettre
00036        s16 ScrollX, ScrollY;  // Scroll x et y...
00037        s16 Repeat;  // Temps avant de répéter...
00038        s16 oldX, oldY; // Ancienne zone touchée
00039 } Keyboards;
00040 extern Keyboards Keyboard;
00041 
00042 extern const u8 PA_Keyboard[2][5][13];
00043 
00044 #define PA_BACKSPACE 1    // On va dire que la touche backspace a pour valeur 1...
00045 #define PA_CAPS      2    // 2 pour CAPS
00046 #define PA_ENTER     '\n'    // 3 pour Enter
00047 #define PA_SHIFT     4    // etc
00048 #define PA_RIEN      0    // Si y'a rien, faudra faire comme si on appuye sur rien
00049 
00050 
00051 
00052 
00053 
00068 void PA_InitKeyboard(u8 bg_number);
00069 
00070 
00077 char PA_CheckKeyboard(void);
00078 
00079 
00080 
00090 extern inline void PA_ScrollKeyboardX(s16 x) {
00091        PA_BGScrollX(0, Keyboard.Bg, -x);
00092        Keyboard.ScrollX = x;
00093 }
00094 
00095 
00105 extern inline void PA_ScrollKeyboardY(s16 y) {
00106        PA_BGScrollY(0, Keyboard.Bg, -y);
00107        Keyboard.ScrollY = y;
00108 }
00109 
00110 
00123 extern inline void PA_ScrollKeyboardXY(s16 x, s16 y) {
00124        PA_BGScrollXY(0, Keyboard.Bg, -x, -y);
00125        Keyboard.ScrollX = x;
00126        Keyboard.ScrollY = y;
00127 }
00128 
00129 
00136 #define PA_EraseLastKey() PA_SetLetterPal(Keyboard.oldX, Keyboard.oldY, 15)
00137 
00138 
00151 extern inline void PA_KeyboardIn(s16 x, s16 y){  // Faire rentrer le clavier... 
00152 s16 i;
00153        PA_ScrollKeyboardXY(x, 192);  // On le sort et met en X. Puis on fait glisser...
00154        for (i = 192; i > y; i-=8){
00155               PA_ScrollKeyboardY(i);
00156               PA_WaitForVBL();
00157        }
00158        PA_ScrollKeyboardY(y);  // On amène pile au bon y...           
00159 }
00160 
00161 
00168 extern inline void PA_KeyboardOut(void){  // Faire sortir le clavier... 
00169 s16 i;
00170 PA_EraseLastKey(); // Efface s'il reste une touche pressée...
00171        for (i = Keyboard.ScrollY; i < 200; i+=8){
00172               PA_ScrollKeyboardY(i);
00173               PA_WaitForVBL();
00174        }
00175 }
00176 
00177 
00178 
00179 
00180  // end of Keyboard
00182 
00183 
00184 
00185 #endif
00186 
00187 

Generated on Fri Oct 28 23:16:50 2005 for PA_lib by  doxygen 1.3.9.1
@ 1.1.1.1 log @Initial import of PalibDoc, begin on PAlib0.64b @ text @@