00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00048 #ifndef __KEYBOARD_H__
00049 #define __KEYBOARD_H__
00050
00051 #include <nds/ndstypes.h>
00052 #include <nds/arm9/background.h>
00053
00055 typedef void (*KeyChangeCallback)(int key);
00056
00061 typedef enum
00062 {
00063 Lower = 0,
00064 Upper = 1,
00065 Numeric = 2,
00066 Reduced = 3
00067 }KeyboardState;
00068
00073 typedef struct KeyMap {
00074 const u16* mapDataPressed;
00075 const u16* mapDataReleased;
00076 const int* keymap;
00077 int width;
00078 int height;
00079 }KeyMap;
00080
00085 typedef struct Keyboard {
00086 int background;
00087 int keyboardOnSub;
00088 int offset_x;
00089 int offset_y;
00090 int grid_width;
00091 int grid_height;
00092 KeyboardState state;
00093 int shifted;
00094 int visible;
00095 KeyMap* mappings[4];
00096
00097
00098
00099
00100 const u16* tiles;
00101 u32 tileLen;
00102 const u16* palette;
00103 u32 paletteLen;
00104 int mapBase;
00105 int tileBase;
00106 int tileOffset;
00107 u32 scrollSpeed;
00108 KeyChangeCallback OnKeyPressed;
00109 KeyChangeCallback OnKeyReleased;
00110 }Keyboard;
00111
00112 #ifdef __cplusplus
00113 extern "C" {
00114 #endif
00115
00119 Keyboard* keyboardGetDefault(void);
00120
00133 Keyboard* keyboardInit(Keyboard* keyboard, int layer, BgType type, BgSize size, int mapBase, int tileBase, bool mainDisplay, bool loadGraphics);
00134
00140 Keyboard* keyboardDemoInit(void);
00144 void keyboardShow(void);
00145
00149 void keyboardHide(void);
00150
00158 int keyboardGetKey(int x, int y);
00159
00166 void keyboardGetString(char * buffer, int maxLen);
00167
00172 int keyboardGetChar(void);
00173
00179 int keyboardUpdate(void);
00180
00181 #ifdef __cplusplus
00182 }
00183 #endif
00184
00185 #endif