Add lime.ui.Joystick and dispatch joystick events
This commit is contained in:
@@ -10,11 +10,11 @@ namespace lime {
|
||||
|
||||
enum GamepadEventType {
|
||||
|
||||
AXIS_MOVE,
|
||||
BUTTON_DOWN,
|
||||
BUTTON_UP,
|
||||
CONNECT,
|
||||
DISCONNECT
|
||||
GAMEPAD_AXIS_MOVE,
|
||||
GAMEPAD_BUTTON_DOWN,
|
||||
GAMEPAD_BUTTON_UP,
|
||||
GAMEPAD_CONNECT,
|
||||
GAMEPAD_DISCONNECT
|
||||
|
||||
};
|
||||
|
||||
|
||||
25
project/include/ui/Joystick.h
Normal file
25
project/include/ui/Joystick.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef LIME_UI_JOYSTICK_H
|
||||
#define LIME_UI_JOYSTICK_H
|
||||
|
||||
|
||||
namespace lime {
|
||||
|
||||
|
||||
class Joystick {
|
||||
|
||||
public:
|
||||
|
||||
static const char* GetDeviceGUID (int id);
|
||||
static const char* GetDeviceName (int id);
|
||||
static int GetNumAxes (int id);
|
||||
static int GetNumButtons (int id);
|
||||
static int GetNumHats (int id);
|
||||
static int GetNumTrackballs (int id);
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
48
project/include/ui/JoystickEvent.h
Normal file
48
project/include/ui/JoystickEvent.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef LIME_UI_JOYSTICK_EVENT_H
|
||||
#define LIME_UI_JOYSTICK_EVENT_H
|
||||
|
||||
|
||||
#include <hx/CFFI.h>
|
||||
|
||||
|
||||
namespace lime {
|
||||
|
||||
|
||||
enum JoystickEventType {
|
||||
|
||||
JOYSTICK_AXIS_MOVE,
|
||||
JOYSTICK_HAT_MOVE,
|
||||
JOYSTICK_TRACKBALL_MOVE,
|
||||
JOYSTICK_BUTTON_DOWN,
|
||||
JOYSTICK_BUTTON_UP,
|
||||
JOYSTICK_CONNECT,
|
||||
JOYSTICK_DISCONNECT
|
||||
|
||||
};
|
||||
|
||||
|
||||
class JoystickEvent {
|
||||
|
||||
public:
|
||||
|
||||
static AutoGCRoot* callback;
|
||||
static AutoGCRoot* eventObject;
|
||||
|
||||
JoystickEvent ();
|
||||
|
||||
static void Dispatch (JoystickEvent* event);
|
||||
|
||||
double eventValue;
|
||||
int id;
|
||||
int index;
|
||||
JoystickEventType type;
|
||||
int x;
|
||||
int y;
|
||||
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user