1 // Copyright 2016 Dolphin Emulator Project 2 // Licensed under GPLv2+ 3 // Refer to the license.txt file included. 4 5 #pragma once 6 7 #include <QuartzCore/QuartzCore.h> 8 9 #include "Common/Matrix.h" 10 #include "InputCommon/ControllerInterface/Device.h" 11 12 namespace ciface::Quartz 13 { 14 std::string KeycodeToName(const CGKeyCode keycode); 15 16 class KeyboardAndMouse : public Core::Device 17 { 18 private: 19 class Key : public Input 20 { 21 public: 22 explicit Key(CGKeyCode keycode); 23 std::string GetName() const override; 24 ControlState GetState() const override; 25 26 private: 27 CGKeyCode m_keycode; 28 std::string m_name; 29 }; 30 31 class Cursor : public Input 32 { 33 public: Cursor(u8 index,const float & axis,const bool positive)34 Cursor(u8 index, const float& axis, const bool positive) 35 : m_axis(axis), m_index(index), m_positive(positive) 36 { 37 } 38 std::string GetName() const override; IsDetectable()39 bool IsDetectable() const override { return false; } 40 ControlState GetState() const override; 41 42 private: 43 const float& m_axis; 44 const u8 m_index; 45 const bool m_positive; 46 }; 47 48 class Button : public Input 49 { 50 public: Button(CGMouseButton button)51 explicit Button(CGMouseButton button) : m_button(button) {} 52 std::string GetName() const override; 53 ControlState GetState() const override; 54 55 private: 56 CGMouseButton m_button; 57 }; 58 59 public: 60 void UpdateInput() override; 61 62 explicit KeyboardAndMouse(void* window); 63 64 std::string GetName() const override; 65 std::string GetSource() const override; 66 67 private: 68 Common::Vec2 m_cursor; 69 70 uint32_t m_windowid; 71 }; 72 } // namespace ciface::Quartz 73