2015-05-24 04:55:12 +00:00
|
|
|
// Copyright 2010 Dolphin Emulator Project
|
2015-05-17 23:08:10 +00:00
|
|
|
// Licensed under GPLv2+
|
2014-02-10 18:54:46 +00:00
|
|
|
// 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:
|
2011-03-14 01:20:11 +00:00
|
|
|
Key(IOHIDElementRef element, IOHIDDeviceRef device);
|
2015-09-17 19:13:41 +00:00
|
|
|
std::string GetName() const override;
|
|
|
|
ControlState GetState() const override;
|
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:
|
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) {}
|
2015-09-17 19:13:41 +00:00
|
|
|
std::string GetName() const override;
|
|
|
|
bool IsDetectable() override { return false; }
|
|
|
|
ControlState GetState() const override;
|
2013-01-18 07:32:07 +00:00
|
|
|
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:
|
2013-08-29 05:33:24 +00:00
|
|
|
Button(u8 index, const unsigned char& button) : m_button(button), m_index(index) {}
|
2015-09-17 19:13:41 +00:00
|
|
|
std::string GetName() const override;
|
|
|
|
ControlState GetState() const override;
|
2013-01-18 07:32:07 +00:00
|
|
|
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:
|
2014-11-13 08:55:14 +00:00
|
|
|
void UpdateInput() override;
|
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
|
|
|
|
2015-06-21 19:28:49 +00:00
|
|
|
std::string GetName() const override;
|
|
|
|
std::string GetSource() const override;
|
|
|
|
int GetId() const override;
|
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
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|