2010-06-26 13:03:25 +00:00
|
|
|
#include <IOKit/hid/IOHIDLib.h>
|
2010-04-27 07:33:33 +00:00
|
|
|
|
2013-06-17 00:07:10 +00:00
|
|
|
#include "../Device.h"
|
2010-04-27 07:33:33 +00:00
|
|
|
|
|
|
|
namespace ciface
|
|
|
|
{
|
|
|
|
namespace OSX
|
|
|
|
{
|
|
|
|
|
2013-06-17 00:07:10 +00:00
|
|
|
class Keyboard : public Core::Device
|
2010-04-27 07:33:33 +00:00
|
|
|
{
|
2011-03-14 01:20:11 +00:00
|
|
|
private:
|
2010-04-27 07:33:33 +00:00
|
|
|
class Key : public Input
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::string GetName() const;
|
2011-03-14 01:20:11 +00:00
|
|
|
Key(IOHIDElementRef element, IOHIDDeviceRef device);
|
|
|
|
ControlState GetState() const;
|
2010-04-27 07:33:33 +00:00
|
|
|
private:
|
2011-03-14 01:20:11 +00:00
|
|
|
const IOHIDElementRef m_element;
|
|
|
|
const IOHIDDeviceRef m_device;
|
2010-04-27 07:33:33 +00:00
|
|
|
std::string m_name;
|
|
|
|
};
|
2013-01-18 07:32:07 +00:00
|
|
|
class Cursor : public Input
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::string GetName() const;
|
|
|
|
bool IsDetectable() { return false; }
|
2013-08-29 05:33:24 +00:00
|
|
|
Cursor(u8 index, const float& axis, const bool positive) : m_axis(axis), m_index(index), m_positive(positive) {}
|
2013-01-18 07:32:07 +00:00
|
|
|
ControlState GetState() const;
|
|
|
|
private:
|
|
|
|
const float& m_axis;
|
|
|
|
const u8 m_index;
|
|
|
|
const bool m_positive;
|
|
|
|
};
|
|
|
|
class Button : public Input
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
std::string GetName() const;
|
2013-08-29 05:33:24 +00:00
|
|
|
Button(u8 index, const unsigned char& button) : m_button(button), m_index(index) {}
|
2013-01-18 07:32:07 +00:00
|
|
|
ControlState GetState() const;
|
|
|
|
private:
|
|
|
|
const unsigned char& m_button;
|
|
|
|
const u8 m_index;
|
|
|
|
};
|
2010-06-26 13:03:25 +00:00
|
|
|
|
2011-03-14 01:20:11 +00:00
|
|
|
public:
|
2010-04-27 07:33:33 +00:00
|
|
|
bool UpdateInput();
|
|
|
|
bool UpdateOutput();
|
2010-06-26 13:03:25 +00:00
|
|
|
|
2013-01-18 07:32:07 +00:00
|
|
|
Keyboard(IOHIDDeviceRef device, std::string name, int index, void *window);
|
2010-06-26 13:03:25 +00:00
|
|
|
|
2010-04-27 07:33:33 +00:00
|
|
|
std::string GetName() const;
|
|
|
|
std::string GetSource() const;
|
|
|
|
int GetId() const;
|
2010-06-26 13:03:25 +00:00
|
|
|
|
2010-04-27 07:33:33 +00:00
|
|
|
private:
|
2013-01-18 07:32:07 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
float x, y;
|
|
|
|
} m_cursor;
|
|
|
|
|
2011-03-14 01:20:11 +00:00
|
|
|
const IOHIDDeviceRef m_device;
|
|
|
|
const std::string m_device_name;
|
2011-01-30 05:46:19 +00:00
|
|
|
int m_index;
|
2013-01-18 07:32:07 +00:00
|
|
|
uint32_t m_windowid;
|
|
|
|
unsigned char m_mousebuttons[3];
|
2010-04-27 07:33:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|