spacenav-driver/spnav.h

58 lines
1.2 KiB
C
Raw Permalink Normal View History

2018-05-22 23:25:02 +00:00
#ifndef SPNAV_H__
#define SPNAV_H__
2018-05-30 09:30:18 +00:00
#include <stdbool.h>
#define SPNAV_NAXIS 6
2018-05-22 23:25:02 +00:00
#ifdef _WIN32
2018-05-30 09:30:18 +00:00
#define SPNAV_API_EXPORT __declspec(dllexport)
#define SPNAV_API_CALL
2018-05-22 23:25:02 +00:00
#else
2018-05-30 09:30:18 +00:00
#define SPNAV_API_EXPORT /**< API export macro */
#define SPNAV_API_CALL /**< API call macro */
2018-05-22 23:25:02 +00:00
#endif
#define SPNAV_API_EXPORT_CALL SPNAV_API_EXPORT SPNAV_API_CALL /**< API export and call macro*/
enum event_type {
ANY,
MOTION,
BUTTON
};
struct event_motion {
2018-05-30 09:30:18 +00:00
int type;
int x, y, z;
int rx, ry, rz;
unsigned int period;
int *data;
2018-05-22 23:25:02 +00:00
};
struct event_button {
2018-05-30 09:30:18 +00:00
int type;
bool press;
int bnum;
2018-05-22 23:25:02 +00:00
};
typedef union spnav_event {
2018-05-30 09:30:18 +00:00
int type;
struct event_motion motion;
struct event_button button;
2018-05-22 23:25:02 +00:00
} spnav_event;
#ifdef __cplusplus
extern "C" {
#endif
int SPNAV_API_EXPORT_CALL spnav_open(unsigned short vendor_id, unsigned short product_id);
2018-05-22 23:25:02 +00:00
int SPNAV_API_EXPORT_CALL spnav_close(void);
int SPNAV_API_EXPORT_CALL spnav_wait_event(spnav_event *event);
2018-05-23 00:41:20 +00:00
int SPNAV_API_EXPORT_CALL spnav_wait_event_timeout(spnav_event *event, int timeout);
2018-05-23 13:06:49 +00:00
int SPNAV_API_EXPORT_CALL spnav_sensitivity(double sens);
2018-05-23 14:18:19 +00:00
int SPNAV_API_EXPORT_CALL spnav_deadzone(int value);
2018-05-22 23:25:02 +00:00
#ifdef __cplusplus
}
#endif
2018-05-23 13:06:49 +00:00
2018-05-22 23:25:02 +00:00
#endif /* SPNAV_H__ */