| 1 |
#include "allegro5/allegro.h" |
| 2 |
#include "allegro5/internal/aintern_keyboard.h" |
| 3 |
#include "allegro5/internal/aintern_events.h" |
| 4 |
|
| 5 |
static ALLEGRO_KEYBOARD the_keyboard; |
| 6 |
|
| 7 |
static bool iphone_init_keyboard(void) |
| 8 |
{ |
| 9 |
memset(&the_keyboard, 0, sizeof the_keyboard); |
| 10 |
_al_event_source_init(&the_keyboard.es); |
| 11 |
return true; |
| 12 |
} |
| 13 |
|
| 14 |
static void iphone_exit_keyboard(void) |
| 15 |
{ |
| 16 |
_al_event_source_free(&the_keyboard.es); |
| 17 |
} |
| 18 |
|
| 19 |
|
| 20 |
static ALLEGRO_KEYBOARD *iphone_get_keyboard(void) |
| 21 |
{ |
| 22 |
return &the_keyboard; |
| 23 |
} |
| 24 |
|
| 25 |
static bool iphone_set_keyboard_leds(int leds) |
| 26 |
{ |
| 27 |
(void)leds; |
| 28 |
return false; |
| 29 |
} |
| 30 |
|
| 31 |
static char const *iphone_keycode_to_name(int keycode) |
| 32 |
{ |
| 33 |
(void)keycode; |
| 34 |
return "none"; |
| 35 |
} |
| 36 |
|
| 37 |
static void iphone_get_keyboard_state(ALLEGRO_KEYBOARD_STATE *ret_state) |
| 38 |
{ |
| 39 |
memset(ret_state, 0, sizeof *ret_state); |
| 40 |
} |
| 41 |
|
| 42 |
static void iphone_clear_keyboard_state(void) |
| 43 |
{ |
| 44 |
return; |
| 45 |
} |
| 46 |
|
| 47 |
static ALLEGRO_KEYBOARD_DRIVER iphone_keyboard_driver = { |
| 48 |
AL_ID('I','P','H','O'), |
| 49 |
"", |
| 50 |
"", |
| 51 |
"iphone keyboard", |
| 52 |
iphone_init_keyboard, |
| 53 |
iphone_exit_keyboard, |
| 54 |
iphone_get_keyboard, |
| 55 |
iphone_set_keyboard_leds, |
| 56 |
iphone_keycode_to_name, |
| 57 |
iphone_get_keyboard_state, |
| 58 |
iphone_clear_keyboard_state |
| 59 |
}; |
| 60 |
|
| 61 |
ALLEGRO_KEYBOARD_DRIVER *_al_get_iphone_keyboard_driver(void) |
| 62 |
{ |
| 63 |
return &iphone_keyboard_driver; |
| 64 |
} |