| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <QuartzCore/QuartzCore.h> |
| 7 |
|
| 8 |
#include "Common/Matrix.h" |
| 9 |
#include "InputCommon/ControllerInterface/CoreDevice.h" |
| 10 |
|
| 11 |
#ifdef __OBJC__ |
| 12 |
@class DolWindowPositionObserver; |
| 13 |
#else |
| 14 |
class DolWindowPositionObserver; |
| 15 |
#endif |
| 16 |
|
| 17 |
namespace ciface::Quartz |
| 18 |
{ |
| 19 |
std::string KeycodeToName(const CGKeyCode keycode); |
| 20 |
|
| 21 |
class KeyboardAndMouse : public Core::Device |
| 22 |
{ |
| 23 |
private: |
| 24 |
class Key : public Input |
| 25 |
{ |
| 26 |
public: |
| 27 |
explicit Key(CGKeyCode keycode); |
| 28 |
std::string GetName() const override; |
| 29 |
ControlState GetState() const override; |
| 30 |
|
| 31 |
private: |
| 32 |
CGKeyCode m_keycode; |
| 33 |
std::string m_name; |
| 34 |
}; |
| 35 |
|
| 36 |
class Cursor : public Input |
| 37 |
{ |
| 38 |
public: |
| 39 |
Cursor(u8 index, const float& axis, const bool positive) |
| 40 |
: m_axis(axis), m_index(index), m_positive(positive) |
| 41 |
{ |
| 42 |
} |
| 43 |
std::string GetName() const override; |
| 44 |
bool IsDetectable() const override { return false; } |
| 45 |
ControlState GetState() const override; |
| 46 |
|
| 47 |
private: |
| 48 |
const float& m_axis; |
| 49 |
const u8 m_index; |
| 50 |
const bool m_positive; |
| 51 |
}; |
| 52 |
|
| 53 |
class Button : public Input |
| 54 |
{ |
| 55 |
public: |
| 56 |
explicit Button(CGMouseButton button) : m_button(button) {} |
| 57 |
std::string GetName() const override; |
| 58 |
ControlState GetState() const override; |
| 59 |
|
| 60 |
private: |
| 61 |
CGMouseButton m_button; |
| 62 |
}; |
| 63 |
|
| 64 |
public: |
| 65 |
Core::DeviceRemoval UpdateInput() override; |
| 66 |
|
| 67 |
explicit KeyboardAndMouse(void* view); |
| 68 |
~KeyboardAndMouse() override; |
| 69 |
|
| 70 |
std::string GetName() const override; |
| 71 |
std::string GetSource() const override; |
| 72 |
int GetSortPriority() const override; |
| 73 |
|
| 74 |
private: |
| 75 |
void MainThreadInitialization(void* view); |
| 76 |
|
| 77 |
Common::Vec2 m_cursor; |
| 78 |
|
| 79 |
DolWindowPositionObserver* m_window_pos_observer; |
| 80 |
}; |
| 81 |
} |