MGL(Win32)
読み取り中…
検索中…
一致する文字列を見つけられません
mgl_iokit_hid_driver.h
[詳解]
1// SPDX-License-Identifier: Zlib
2/* ------------------------------------------------------------------------- */
9/* ------------------------------------------------------------------------- */
10
11#ifndef INCGUARD_MGL_IOKIT_HID_DRIVER_H_1610354956
12#define INCGUARD_MGL_IOKIT_HID_DRIVER_H_1610354956
13
14#include <mgl/mgl_environment.h>
15#if defined(MGL_GAMEPAD_DELEGATE_ENABLE_IOKIT_HID)
16
17#include <cstdint>
18
19#include <IOKit/hid/IOHIDManager.h>
20
23
24namespace MGL::Input::IOKitHID
25{
27class GamepadDriver
28{
29public:
30 virtual ~GamepadDriver() noexcept = default;
31
32 /* ------------------------------------------------------------------------- */
39 /* ------------------------------------------------------------------------- */
40 virtual bool Initialize(IOHIDDeviceRef device) noexcept = 0;
41
42 /* ------------------------------------------------------------------------- */
50 /* ------------------------------------------------------------------------- */
51 virtual bool UpdateState(MGL::Input::PadState &state, IOHIDDeviceRef device) noexcept = 0;
52};
53
54
55/* ------------------------------------------------------------------------- */
63/* ------------------------------------------------------------------------- */
64template <class DriverClass>
65STL::unique_ptr<GamepadDriver> MakeGamepadDriver(int32_t vendorID, int32_t productID) noexcept
66{
67 if (DriverClass::IsManageable(vendorID, productID))
68 {
69 return STL::make_unique<DriverClass>();
70 }
71
72 return nullptr;
73}
74
76using MakeGamepadDriverFunction = STL::unique_ptr<GamepadDriver> (*)(int32_t vendorID, int32_t productID);
77
78} // namespace MGL::Input::IOKitHID
79#endif // MGL_GAMEPAD_DELEGATE_ENABLE_IOKIT_HID
80#endif // INCGUARD_MGL_IOKIT_HID_DRIVER_H_1610354956
81
82// vim: et ts=4 sw=4 sts=4
MGL 環境定義
MGL ゲームパッドステート
MGL STLのメモリ関連の代替