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:
|
2016-06-24 08:43:46 +00:00
|
|
|
class Key : public Input
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Key(IOHIDElementRef element, IOHIDDeviceRef device);
|
|
|
|
std::string GetName() const override;
|
|
|
|
ControlState GetState() const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
const IOHIDElementRef m_element;
|
|
|
|
const IOHIDDeviceRef m_device;
|
|
|
|
std::string m_name;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Cursor : public Input
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Cursor(u8 index, const float& axis, const bool positive)
|
|
|
|
: m_axis(axis), m_index(index), m_positive(positive)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
std::string GetName() const override;
|
|
|
|
bool IsDetectable() override { return false; }
|
|
|
|
ControlState GetState() const override;
|
2014-02-16 20:30:18 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
private:
|
|
|
|
const float& m_axis;
|
|
|
|
const u8 m_index;
|
|
|
|
const bool m_positive;
|
|
|
|
};
|
2014-02-16 20:30:18 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
class Button : public Input
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Button(u8 index, const unsigned char& button) : m_button(button), m_index(index) {}
|
|
|
|
std::string GetName() const override;
|
|
|
|
ControlState GetState() const override;
|
|
|
|
|
|
|
|
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:
|
2016-06-24 08:43:46 +00:00
|
|
|
void UpdateInput() override;
|
2010-06-26 13:03:25 +00:00
|
|
|
|
2016-07-14 08:25:52 +00:00
|
|
|
Keyboard(IOHIDDeviceRef device, std::string name, void* window);
|
2010-06-26 13:03:25 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
std::string GetName() const override;
|
|
|
|
std::string GetSource() const override;
|
2010-06-26 13:03:25 +00:00
|
|
|
|
2010-04-27 07:33:33 +00:00
|
|
|
private:
|
2016-06-24 08:43:46 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
float x, y;
|
|
|
|
} m_cursor;
|
2013-01-18 07:32:07 +00:00
|
|
|
|
2016-06-24 08:43:46 +00:00
|
|
|
const IOHIDDeviceRef m_device;
|
|
|
|
const std::string m_device_name;
|
|
|
|
uint32_t m_windowid;
|
|
|
|
unsigned char m_mousebuttons[3];
|
2010-04-27 07:33:33 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|