MGL(Win32)
読み取り中…
検索中…
一致する文字列を見つけられません
mgl_iokit_hid_axis.h
[詳解]
1// SPDX-License-Identifier: Zlib
2/* ------------------------------------------------------------------------- */
9/* ------------------------------------------------------------------------- */
10
11#ifndef INCGUARD_MGL_IOKIT_HID_AXIS_H_1610554308
12#define INCGUARD_MGL_IOKIT_HID_AXIS_H_1610554308
13
14#include <mgl/mgl_environment.h>
15#if defined(MGL_GAMEPAD_DELEGATE_ENABLE_IOKIT_HID)
16
17#include <IOKit/hid/IOHIDManager.h>
18
19namespace MGL::Input::IOKitHID
20{
22class Axis
23{
24public:
25 void SetParameter(IOHIDElementRef elemRef) noexcept;
26 [[nodiscard]] float GetValue(int32_t value) const noexcept;
27
28 /* ------------------------------------------------------------------------- */
35 /* ------------------------------------------------------------------------- */
36 [[nodiscard]] constexpr bool IsPositive(int32_t value) const noexcept
37 {
38 return (_isAvailable && (static_cast<float>(value) > (_center + _threshold)));
39 }
40
41 /* ------------------------------------------------------------------------- */
48 /* ------------------------------------------------------------------------- */
49 [[nodiscard]] constexpr bool IsNegative(int32_t value) const noexcept
50 {
51 return (_isAvailable && (static_cast<float>(value) < (_center - _threshold)));
52 }
53
54private:
55 bool _isAvailable{false};
56 float _min{0.0f};
57 float _max{0.0f};
58 float _center{0.0f};
59 float _threshold{0.0f};
60};
61} // namespace MGL::Input::IOKitHID
62
63#endif // MGL_GAMEPAD_DELEGATE_ENABLE_IOKIT_HID
64#endif // INCGUARD_MGL_IOKIT_HID_AXIS_H_1610554308
65
66// vim: et ts=4 sw=4 sts=4
uint32_t GetValue(Identifier identifier) noexcept
実績の達成状況を整数値で取得
Definition mgl_achievement.h:100
MGL 環境定義