2014-02-10 18:54:46 +00:00
|
|
|
// Copyright 2014 Dolphin Emulator Project
|
|
|
|
// Licensed under GPLv2
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2010-06-26 13:03:25 +00:00
|
|
|
#include <IOKit/hid/IOHIDLib.h>
|
2010-04-27 07:33:33 +00:00
|
|
|
|
2014-02-17 10:18:15 +00:00
|
|
|
#include "InputCommon/ControllerInterface/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:
|
2014-02-16 20:30:18 +00:00
|
|
|
const IOHIDElementRef m_element;
|
|
|
|
const IOHIDDeviceRef m_device;
|
|
|
|
std::string m_name;
|
2010-04-27 07:33:33 +00:00
|
|
|
};
|
2014-02-16 20:30:18 +00:00
|
|
|
|
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;
|
2014-02-16 20:30:18 +00:00
|
|
|
const u8 m_index;
|
|
|
|
const bool m_positive;
|
2013-01-18 07:32:07 +00:00
|
|
|
};
|
2014-02-16 20:30:18 +00:00
|
|
|
|
2013-01-18 07:32:07 +00:00
|
|
|
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;
|
|
|
|
|
2014-02-16 20:30:18 +00:00
|
|
|
const IOHIDDeviceRef m_device;
|
|
|
|
const std::string m_device_name;
|
|
|
|
int m_index;
|
|
|
|
uint32_t m_windowid;
|
|
|
|
unsigned char m_mousebuttons[3];
|
2010-04-27 07:33:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|