1 module allegro5.joystick; 2 3 import allegro5.events; 4 import allegro5.internal.da5; 5 6 nothrow @nogc extern (C) 7 { 8 private const int _AL_MAX_JOYSTICK_AXES = 3; 9 private const int _AL_MAX_JOYSTICK_STICKS = 16; 10 private const int _AL_MAX_JOYSTICK_BUTTONS = 32; 11 12 struct ALLEGRO_JOYSTICK {}; 13 14 struct ALLEGRO_JOYSTICK_STATE 15 { 16 struct STICK 17 { 18 float[_AL_MAX_JOYSTICK_AXES] axis; /* -1.0 to 1.0 */ 19 }; 20 STICK[_AL_MAX_JOYSTICK_STICKS] stick; 21 int[_AL_MAX_JOYSTICK_BUTTONS] button; /* 0 to 32767 */ 22 }; 23 24 enum ALLEGRO_JOYFLAGS 25 { 26 ALLEGRO_JOYFLAG_DIGITAL = 0x01, 27 ALLEGRO_JOYFLAG_ANALOGUE = 0x02 28 } 29 30 31 32 bool al_install_joystick(); 33 void al_uninstall_joystick(); 34 bool al_is_joystick_installed(); 35 bool al_reconfigure_joysticks(); 36 37 int al_get_num_joysticks(); 38 ALLEGRO_JOYSTICK* al_get_joystick(int joyn); 39 void al_release_joystick(ALLEGRO_JOYSTICK* joystick); 40 bool al_get_joystick_active(ALLEGRO_JOYSTICK* joystick); 41 const(char)* al_get_joystick_name(ALLEGRO_JOYSTICK* joystick); 42 43 int al_get_joystick_num_sticks(in ALLEGRO_JOYSTICK* joystick); 44 int al_get_joystick_stick_flags(in ALLEGRO_JOYSTICK* joystick, int stick); /* junk? */ 45 const(char)* al_get_joystick_stick_name(in ALLEGRO_JOYSTICK* joystick, int stick); 46 47 int al_get_joystick_num_axes(in ALLEGRO_JOYSTICK* joystick, int stick); 48 const(char)* al_get_joystick_axis_name(in ALLEGRO_JOYSTICK* joystick, int stick, int axis); 49 50 int al_get_joystick_num_buttons(in ALLEGRO_JOYSTICK* joystick); 51 const(char)* al_get_joystick_button_name(in ALLEGRO_JOYSTICK* joystick, int buttonn); 52 53 void al_get_joystick_state(ALLEGRO_JOYSTICK* joystick, ALLEGRO_JOYSTICK_STATE* ret_state); 54 55 ALLEGRO_EVENT_SOURCE* al_get_joystick_event_source(); 56 } 57