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
00024
00025
00026
00027 extern const unsigned char keyboard_Tiles[10240];
00028 extern const unsigned short keyboard_Map[4096];
00029
00030
00031
00032 typedef struct {
00033 u8 Bg;
00034 u8 Type;
00035 char Letter;
00036 s16 ScrollX, ScrollY;
00037 s16 Repeat;
00038 s16 oldX, oldY;
00039 u8 Color1, Color2;
00040 } Keyboards;
00041 extern Keyboards Keyboard;
00042
00043 extern const u8 PA_Keyboard[2][5][24];
00044
00045 #define PA_BACKSPACE 1 // On va dire que la touche backspace a pour valeur 1...
00046 #define PA_CAPS 2 // 2 pour CAPS
00047 #define PA_ENTER '\n' // 3 pour Enter
00048 #define PA_SHIFT 4 // etc
00049 #define PA_RIEN 0 // Si y'a rien, faudra faire comme si on appuye sur rien
00050 #define PA_TAB 3 // tab...
00051
00052
00053
00054
00069 void PA_InitKeyboard(u8 bg_number);
00070
00071
00078 char PA_CheckKeyboard(void);
00079
00080
00081
00091 extern inline void PA_ScrollKeyboardX(s16 x) {
00092 PA_BGScrollX(0, Keyboard.Bg, -x);
00093 Keyboard.ScrollX = x;
00094 }
00095
00096
00106 extern inline void PA_ScrollKeyboardY(s16 y) {
00107 PA_BGScrollY(0, Keyboard.Bg, -y);
00108 Keyboard.ScrollY = y;
00109 }
00110
00111
00124 extern inline void PA_ScrollKeyboardXY(s16 x, s16 y) {
00125 PA_BGScrollXY(0, Keyboard.Bg, -x, -y);
00126 Keyboard.ScrollX = x;
00127 Keyboard.ScrollY = y;
00128 }
00129
00130
00137 #define PA_EraseLastKey() PA_SetLetterPal(Keyboard.oldX, Keyboard.oldY, 15)
00138
00139
00152 extern inline void PA_KeyboardIn(s16 x, s16 y){
00153 s16 i;
00154 PA_ScrollKeyboardXY(x, 192);
00155 for (i = 192; i > y; i-=8){
00156 PA_ScrollKeyboardY(i);
00157 PA_WaitForVBL();
00158 }
00159 PA_ScrollKeyboardY(y);
00160 }
00161
00162
00169 extern inline void PA_KeyboardOut(void){
00170 s16 i;
00171 PA_EraseLastKey();
00172 for (i = Keyboard.ScrollY; i < 200; i+=8){
00173 PA_ScrollKeyboardY(i);
00174 PA_WaitForVBL();
00175 }
00176 }
00177
00178
00179
00180
00187 void PA_ReloadKeyboardCol(void);
00188
00189
00202 extern inline void PA_SetKeyboardColor(u8 color1, u8 color2){
00203 Keyboard.Color1 = color1;
00204 Keyboard.Color2 = color2;
00205 PA_ReloadKeyboardCol();
00206 }
00207
00208
00210
00211
00212
00213 #endif
00214
00215