umf_js.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef _UMF_JOY_H_
  2. #define _UMF_JOY_H_
  3. #include "types.h"
  4. typedef void (*JOY_CallBack_t) (UINT32 KeyCode, UINT32 joypadNum);
  5. #define JS_EVENT_BUTTON 0x01 /* button pressed/released */
  6. #define JS_EVENT_AXIS 0x02 /* joystick moved */
  7. #define JS_EVENT_INIT 0x80 /* initial state of device */
  8. #define JS_BTN_PRESSED 1
  9. #define JS_BTN_RELEASED 0
  10. #define MAX_JSNAME_LEN 128
  11. #define MAX_KEY_SIZE 1
  12. #define MAX_EVENT_SIZE 22
  13. #define MAX_JS_NUMBER 2
  14. #define STORE_MAX_JSPAD 5
  15. typedef struct {
  16. unsigned int time; /* event timestamp in milliseconds */
  17. short value; /* value */
  18. unsigned char type; /* event type */
  19. unsigned char number; /* axis/button number */
  20. }js_event_t;
  21. typedef struct {
  22. short value; /* value */
  23. unsigned char type; /* event type */
  24. unsigned char number; /* axis/button number */
  25. }js_key_t;
  26. int joystick_init(JOY_CallBack_t pJoy_CallBackFunc);
  27. int joystick_add_dev(void);
  28. int joystick_remove_dev(void);
  29. int joystick_AddEvent_Start(UINT32 event);
  30. int joystick_AddEvent_Finish(void);
  31. void joystick_SetJSNumber(UINT8 js_number);
  32. int joystick_GetDevNumber(void);
  33. int joystick_Save(UINT8 js_number);
  34. void joystick_Convert_UIEvent_Set(INT32 bConvert);
  35. int joystick_Convert_UIEvent_Get(void);
  36. #endif