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
00027
00028
00029
00030 extern const unsigned char keyboard_Tiles[10240];
00031 extern const unsigned short keyboard_Map[4096];
00032
00033
00034
00035 typedef struct {
00036 u8 Bg;
00037 u8 Type;
00038 char Letter;
00039 s16 ScrollX, ScrollY;
00040 s16 Repeat;
00041 s16 oldX, oldY;
00042 u8 Color1, Color2;
00043 u8 Custom;
00044 } Keyboards;
00045 extern Keyboards Keyboard;
00046
00047 extern const u8 PA_Keyboard[2][5][24];
00048
00049
00050
00051
00066 void PA_InitKeyboard(u8 bg_number);
00067
00068
00069
00082 #define PA_InitCustomKeyboard(bg_number, keyb_custom) {\
00083 PA_LoadBgPal(0, bg_number, (void*)keyb_custom##_Pal);\
00084 PA_LoadSimpleBg(0, bg_number, keyb_custom##_Tiles, keyb_custom##_Map, BG_256X512, 1, 1);\
00085 Keyboard.Bg = bg_number; Keyboard.Type = 0; Keyboard.Repeat = 0; Keyboard.Custom = 1;\
00086 PA_BgInfo[0][Keyboard.Bg].Map = (u32)keyb_custom##_Map;\
00087 }
00088
00089
00096 char PA_CheckKeyboard(void);
00097
00098
00099
00109 extern inline void PA_ScrollKeyboardX(s16 x) {
00110 PA_BGScrollX(0, Keyboard.Bg, -x);
00111 Keyboard.ScrollX = x;
00112 }
00113
00114
00124 extern inline void PA_ScrollKeyboardY(s16 y) {
00125 PA_BGScrollY(0, Keyboard.Bg, -y);
00126 Keyboard.ScrollY = y;
00127 }
00128
00129
00142 extern inline void PA_ScrollKeyboardXY(s16 x, s16 y) {
00143 PA_BGScrollXY(0, Keyboard.Bg, -x, -y);
00144 Keyboard.ScrollX = x;
00145 Keyboard.ScrollY = y;
00146 }
00147
00148
00155 #define PA_EraseLastKey() PA_SetLetterPal(Keyboard.oldX, Keyboard.oldY, 15)
00156
00157
00170 extern inline void PA_KeyboardIn(s16 x, s16 y){
00171 s16 i;
00172 PA_ScrollKeyboardXY(x, 192);
00173 for (i = 192; i > y; i-=8){
00174 PA_ScrollKeyboardY(i);
00175 PA_WaitForVBL();
00176 }
00177 PA_ScrollKeyboardY(y);
00178 }
00179
00180
00187 extern inline void PA_KeyboardOut(void){
00188 s16 i;
00189 PA_EraseLastKey();
00190 for (i = Keyboard.ScrollY; i < 200; i+=8){
00191 PA_ScrollKeyboardY(i);
00192 PA_WaitForVBL();
00193 }
00194 }
00195
00196
00197
00198
00205 void PA_ReloadKeyboardCol(void);
00206
00207
00220 extern inline void PA_SetKeyboardColor(u8 color1, u8 color2){
00221 Keyboard.Color1 = color1;
00222 Keyboard.Color2 = color2;
00223 PA_ReloadKeyboardCol();
00224 }
00225
00226
00228
00229 #ifdef __cplusplus
00230 }
00231 #endif
00232
00233 #endif
00234
00235