#ifndef INCLUDED_KEYBOARDS_DANZEFF_H
#define INCLUDED_KEYBOARDS_DANZEFF_H

//danzeff is BSD licensed, if you do make a new renderer then please share it back and I can add it
//to the original distribution.

//Set which renderer target to build for (currently only SDL is available)
#define DANZEFF_SDL
//TODO #define DANZEFF_SCEGU etc etc ;)

#define DANZEFF_SELECT          1
#define DANZEFF_START           2

#define DANZEFF_ESCAPE          3
#define DANZEFF_LEFT            4
#define DANZEFF_RIGHT           5
#define DANZEFF_UP              6
#define DANZEFF_DOWN            7

#define DANZEFF_PAGE_UP         8
#define DANZEFF_PAGE_DOWN       9
#define DANZEFF_END            10
#define DANZEFF_HOME           11
#define DANZEFF_INSERT         12
#define DANZEFF_DEL            13
#define DANZEFF_TAB            14

#define DANZEFF_F1             21
#define DANZEFF_F2             22
#define DANZEFF_F3             23
#define DANZEFF_F4             24
#define DANZEFF_F5             25
#define DANZEFF_F6             26
#define DANZEFF_F7             27
#define DANZEFF_F8             28
#define DANZEFF_F9             29
#define DANZEFF_CLEAR          30

#define DANZEFF_CTRL_A         -1
#define DANZEFF_CTRL_B         -2
#define DANZEFF_CTRL_C         -3
#define DANZEFF_CTRL_D         -4
#define DANZEFF_CTRL_E         -5
#define DANZEFF_CTRL_F         -6
#define DANZEFF_CTRL_G         -7
#define DANZEFF_CTRL_H         -8
#define DANZEFF_CTRL_I         -9
#define DANZEFF_CTRL_J        -10
#define DANZEFF_CTRL_K        -11
#define DANZEFF_CTRL_L        -12
#define DANZEFF_CTRL_M        -13
#define DANZEFF_ENTER          DANZEFF_CTRL_M
#define DANZEFF_CTRL_N        -14
#define DANZEFF_CTRL_O        -15
#define DANZEFF_CTRL_P        -16
#define DANZEFF_CTRL_Q        -17
#define DANZEFF_CTRL_R        -18
#define DANZEFF_CTRL_S        -19
#define DANZEFF_CTRL_T        -20
#define DANZEFF_CTRL_U        -21
#define DANZEFF_CTRL_V        -22
#define DANZEFF_CTRL_W        -23
#define DANZEFF_CTRL_X        -24
#define DANZEFF_CTRL_Y        -25
#define DANZEFF_CTRL_Z        -26

#define DANZEFF_ALT_A         -31
#define DANZEFF_ALT_B         -32
#define DANZEFF_ALT_C         -33
#define DANZEFF_ALT_D         -34
#define DANZEFF_ALT_E         -35
#define DANZEFF_ALT_F         -36
#define DANZEFF_ALT_G         -37
#define DANZEFF_ALT_H         -38
#define DANZEFF_ALT_I         -39
#define DANZEFF_ALT_J         -40
#define DANZEFF_ALT_K         -41
#define DANZEFF_ALT_L         -42
#define DANZEFF_ALT_M         -43
#define DANZEFF_ALT_N         -44
#define DANZEFF_ALT_O         -45
#define DANZEFF_ALT_P         -46
#define DANZEFF_ALT_Q         -47
#define DANZEFF_ALT_R         -48
#define DANZEFF_ALT_S         -49
#define DANZEFF_ALT_T         -50
#define DANZEFF_ALT_U         -51
#define DANZEFF_ALT_V         -52
#define DANZEFF_ALT_W         -53
#define DANZEFF_ALT_X         -54
#define DANZEFF_ALT_Y         -55
#define DANZEFF_ALT_Z         -56


//the SDL implementation needs the pspctrl_emu wrapper to convert
//a SDL_Joystick into a SceCtrlData
#include <pspctrl.h>

#ifdef __cplusplus
extern "C" {
#endif

 extern int   psp_kbd_skin;
 extern int   psp_kbd_last_skin;
 extern char *psp_kbd_skin_dir[];

//Initialization and de-init of the keyboard, provided as the keyboard uses alot of images, so if you aren't going to use it for a while, I'd recommend unloading it.
extern int danzeff_load(void);
extern void danzeff_free(void);

//returns true if the keyboard is initialized
extern int danzeff_isinitialized(void);

/** Attempts to read a character from the controller
* If no character is pressed then we return 0
* Other special values: 1 = move left, 2 = move right, 3 = select, 4 = start
* Every other value should be a standard ascii value.
* An unsigned int is returned so in the future we can support unicode input
*/
extern int danzeff_readInput(SceCtrlData pspctrl);

//Move the area the keyboard is rendered at to here
extern void danzeff_moveTo(const int newX, const int newY);

//Returns true if the keyboard that would be rendered now is different to the last time
//that the keyboard was drawn, this is altered by readInput/render.
extern   int danzeff_dirty();

//draw the keyboard to the screen
extern void danzeff_render();

///Functions only for particular renderers:

#include <SDL/SDL.h>
//set the screen surface for rendering on.
extern void danzeff_set_screen(SDL_Surface* screen);


#ifdef __cplusplus
}
#endif

#endif //INCLUDED_KEYBOARDS_DANZEFF_H
