src/keyboard.h

Thu, 30 Dec 2010 00:37:03 +0000

author
Philip Pemberton <philpem@philpem.me.uk>
date
Thu, 30 Dec 2010 00:37:03 +0000
changeset 86
ebce87d87808
child 90
934ae2efdd01
permissions
-rw-r--r--

add keyboard event handler; need to do register r/w next.

     1 #ifndef _KEYBOARD_H
     2 #define _KEYBOARD_H
     4 #define KEYBOARD_BUFFER_SIZE 0x100
     6 /**
     7  * Keyboard controller state
     8  */
     9 typedef struct {
    10 	unsigned char	keybuf[KEYBOARD_BUFFER_SIZE];		///< Keyboard data buffer
    11 	size_t			readptr;							///< Keyboard buffer read pointer
    12 	size_t			writeptr;							///< Keyboard buffer write pointer
    13 	size_t			buflen;								///< Keyboard buffer fill level (buffer length)
    14 	int				keystate[0x80];						///< List of key up/down states
    15 } KEYBOARD_STATE;
    17 /**
    18  * Initialise the keyboard.
    19  *
    20  * Initialises a keyboard state block in preparation for keyboard events.
    21  *
    22  * @param	state	Keyboard state block
    23  */
    24 void keyboard_init(KEYBOARD_STATE *state);
    26 /**
    27  * Issue a keyboard event.
    28  *
    29  * Call this function when SDL issues a keyboard event in the event loop.
    30  */
    31 void keyboard_event(KEYBOARD_STATE *state, SDL_Event *ev);
    33 #endif