#ifndef GCTL_H #define GCTL_H #include "../include/osw-x.h" typedef struct _xsw_gctl_struct xsw_gctl_struct; #define XSW_GCTL(p) ((xsw_gctl_struct *)(p)) /* * Controller Types: */ #define XSW_CONTROLLER_KEYBOARD 0 #define XSW_CONTROLLER_JOYSTICK 1 #define XSW_CONTROLLER_POINTER 2 /* Not supported yet */ /* * Game Controller: */ struct _xsw_gctl_struct { int type; /* One of XSW_CONTROLLER_* */ float turn, /* -1 to 1 */ throttle, /* 0.0 to 1.0 */ thrust_dir, /* -1 to 1 (0 is directly backwards) */ vs_zoom, /* 0 to 1 */ scanner_zoom, /* 0 to 1 */ aim_weapon_heading, /* -1 to 1 */ aim_weapon_pitch; /* -1 to 1 */ bool_t fire_weapon, omni_dir_thrust, external_dampers; /* Brakes */ /* Previous key states */ bool_t pks_turn_left, pks_turn_right, pks_throttle_inc, pks_throttle_dec, pks_throttle_idle, pks_throttle_max, pks_fire_weapon, pks_omni_dir_thrust, pks_external_dampers; }; /* gctl.cpp */ extern "C" xsw_gctl_struct *GCtlNew(const int type); extern "C" int GCtlManageGUIKeyEvent( xsw_gctl_struct *gctl, event_t *event, void *bw_ptr ); extern "C" void GCtlResetKeys(xsw_gctl_struct *gctl); extern "C" void GCtlManageJoysticks(xsw_gctl_struct *gctl); extern "C" void GCtlManage( xsw_gctl_struct *gctl, const time_t cur_ms, const time_t cur_sec, const float tc ); extern "C" void GCtlDelete(xsw_gctl_struct *gctl); #endif /* GCTL_H */