2016-08-09 22:48:22 +00:00
|
|
|
// Copyright 2016 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2016-08-08 16:38:22 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2016-08-09 22:48:22 +00:00
|
|
|
#include <QuartzCore/QuartzCore.h>
|
|
|
|
|
2020-01-24 06:06:39 +00:00
|
|
|
#include "Common/Matrix.h"
|
2020-09-15 11:34:41 +00:00
|
|
|
#include "InputCommon/ControllerInterface/CoreDevice.h"
|
2016-08-08 16:38:22 +00:00
|
|
|
|
2022-08-12 08:02:47 +00:00
|
|
|
#ifdef __OBJC__
|
|
|
|
@class DolWindowPositionObserver;
|
|
|
|
#else
|
|
|
|
class DolWindowPositionObserver;
|
|
|
|
#endif
|
|
|
|
|
2019-06-17 20:39:24 +00:00
|
|
|
namespace ciface::Quartz
|
2016-08-08 16:38:22 +00:00
|
|
|
{
|
2016-08-10 02:59:45 +00:00
|
|
|
std::string KeycodeToName(const CGKeyCode keycode);
|
|
|
|
|
2016-08-08 16:38:22 +00:00
|
|
|
class KeyboardAndMouse : public Core::Device
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
class Key : public Input
|
|
|
|
{
|
|
|
|
public:
|
2016-08-09 22:48:22 +00:00
|
|
|
explicit Key(CGKeyCode keycode);
|
2016-08-08 16:38:22 +00:00
|
|
|
std::string GetName() const override;
|
|
|
|
ControlState GetState() const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
CGKeyCode m_keycode;
|
2016-08-10 02:54:59 +00:00
|
|
|
std::string m_name;
|
2016-08-08 16:38:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
2020-02-22 16:27:43 +00:00
|
|
|
bool IsDetectable() const override { return false; }
|
2016-08-08 16:38:22 +00:00
|
|
|
ControlState GetState() const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
const float& m_axis;
|
|
|
|
const u8 m_index;
|
|
|
|
const bool m_positive;
|
|
|
|
};
|
|
|
|
|
|
|
|
class Button : public Input
|
|
|
|
{
|
|
|
|
public:
|
2016-08-09 22:48:22 +00:00
|
|
|
explicit Button(CGMouseButton button) : m_button(button) {}
|
2016-08-08 16:38:22 +00:00
|
|
|
std::string GetName() const override;
|
|
|
|
ControlState GetState() const override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
CGMouseButton m_button;
|
|
|
|
};
|
|
|
|
|
|
|
|
public:
|
2023-05-24 19:58:30 +00:00
|
|
|
Core::DeviceRemoval UpdateInput() override;
|
2016-08-08 16:38:22 +00:00
|
|
|
|
2021-07-06 08:46:27 +00:00
|
|
|
explicit KeyboardAndMouse(void* view);
|
2022-08-12 08:02:47 +00:00
|
|
|
~KeyboardAndMouse() override;
|
2016-08-08 16:38:22 +00:00
|
|
|
|
|
|
|
std::string GetName() const override;
|
|
|
|
std::string GetSource() const override;
|
|
|
|
|
|
|
|
private:
|
2022-08-12 08:02:47 +00:00
|
|
|
void MainThreadInitialization(void* view);
|
|
|
|
|
2020-01-24 06:06:39 +00:00
|
|
|
Common::Vec2 m_cursor;
|
2016-08-08 16:38:22 +00:00
|
|
|
|
2022-08-12 08:02:47 +00:00
|
|
|
DolWindowPositionObserver* m_window_pos_observer;
|
2016-08-08 16:38:22 +00:00
|
|
|
};
|
2019-06-17 20:39:24 +00:00
|
|
|
} // namespace ciface::Quartz
|