1 module allegro5.touch_input; 2 3 import allegro5.base; 4 import allegro5.events; 5 import allegro5.display; 6 7 version (ALLEGRO_UNSTABLE) 8 version = AllegroTouchUnstable; 9 version(ALLEGRO_INTERNAL_UNSTABLE) 10 version = AllegroTouchUnstable; 11 version(ALLEGRO_SRC) 12 version = AllegroTouchUnstable; 13 14 nothrow @nogc extern (C) 15 { 16 /* Maximum number of simultaneous touches. */ 17 const size_t ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT = 16; 18 19 struct ALLEGRO_TOUCH_INPUT {}; 20 21 struct ALLEGRO_TOUCH_STATE 22 { 23 /* (id) An identifier of touch. If touch is valid this number is positive. 24 * (x, y) Touch position on the screen in 1:1 resolution. 25 * (dx, dy) Relative touch position. 26 * (primary) True, if touch is a primary one (usually first one). 27 * (display) Display at which the touch belong. 28 */ 29 int id; 30 float x, y; 31 float dx, dy; 32 bool primary; 33 ALLEGRO_DISPLAY* display; 34 } 35 36 struct ALLEGRO_TOUCH_INPUT_STATE 37 { 38 ALLEGRO_TOUCH_STATE[ALLEGRO_TOUCH_INPUT_MAX_TOUCH_COUNT] touches; 39 } 40 41 version (AllegroTouchUnstable) 42 { 43 enum ALLEGRO_MOUSE_EMULATION_MODE 44 { 45 ALLEGRO_MOUSE_EMULATION_NONE, 46 ALLEGRO_MOUSE_EMULATION_TRANSPARENT, 47 ALLEGRO_MOUSE_EMULATION_INCLUSIVE, 48 ALLEGRO_MOUSE_EMULATION_EXCLUSIVE, 49 ALLEGRO_MOUSE_EMULATION_5_0_x 50 } 51 } 52 53 bool al_is_touch_input_installed(); 54 bool al_install_touch_input(); 55 void al_uninstall_touch_input(); 56 void al_get_touch_input_state(ALLEGRO_TOUCH_INPUT_STATE* ret_state); 57 ALLEGRO_EVENT_SOURCE* al_get_touch_input_event_source(); 58 59 version (AllegroTouchUnstable) 60 { 61 void al_set_mouse_emulation_mode(int mode); 62 int al_get_mouse_emulation_mode(); 63 ALLEGRO_EVENT_SOURCE* al_get_touch_input_mouse_emulation_event_source(); 64 } 65 } 66