-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInputManager.h
More file actions
131 lines (113 loc) · 3.93 KB
/
Copy pathInputManager.h
File metadata and controls
131 lines (113 loc) · 3.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#pragma once
#include <mathematics/vector2.hpp>
#include <mathematics/vector4.hpp>
#include <GameInput.h>
#include "ClassProperty.h"
#include "KeyState.h"
#include "KeyArray.h"
#include "KeyBitFlag.h"
// GameInput API v3(GAMEINPUT_API_VERSION 3)부터 ëª¨ë“ íƒ€ìž…ì´
// GameInput::v3 네임스페ì´ìФ 안으로 들어갔다(ì´ì „ ë²„ì „ì€ ì „ì—ì´ì—ˆë‹¤).
using namespace GameInput::v3;
using namespace Microsoft::WRL;
class InputManager : public Singleton<InputManager>
{
friend class Singleton<InputManager>;
private:
InputManager() = default;
~InputManager() = default;
public:
bool Initialize(HWND _hwnd);
void Update(float deltaTime);
public:
//Űº¸µå ¸¶¿ì½º ***** Down Pressed holdÀΰŠDown ùƽµµ¹Þ°Ô ¼öÁ¤ÇÊ¿ä À̸§ ÅëÀÏÇÊ¿ä
void KeyBoardUpdate();
//´©¸§
bool IsKeyDown(auto key) const
{
return m_keyboardState.GetKeyState(static_cast<size_t>(key)) == KeyState::Down;
}
// ´©¸£´ÂÁß
bool IsKeyPressed(auto key) const
{
return m_keyboardState.GetKeyState(static_cast<size_t>(key)) == KeyState::Pressed;
}
//¶À
bool IsKeyReleased(auto key) const
{
return m_keyboardState.GetKeyState(static_cast<size_t>(key)) == KeyState::Released;
}
//Ű ¼¼ÆÃ º¯°æ¿ë?
bool IsAnyKeyPressed();
void MouseUpdate();
void SetMousePos(POINT pos);
math::vector2 GetMousePos();
math::vector2 GetMouseDelta() const;
bool IsWheelUp();
bool IsWheelDown();
//´©¸£´ÂÁß
bool IsMouseButtonDown(MouseKey button);
//Çѹø´©¸¥°Å
bool IsMouseButtonPressed(MouseKey button);
//¶À
bool IsMouseButtonReleased(MouseKey button);
void HideCursor();
void ShowCursor();
void ResetMouseDelta();
int16 GetWheelDelta() const;
public:
//ÀÌ ¾Æ·¡´Â ÆÐµå ÄÁÆ®·Ñ·¯
void PadUpdate();
void GamePadUpdate();
bool IsControllerConnected(DWORD Index);
bool IsControllerButtonDown(DWORD index, ControllerButton btn) const;
bool IsControllerButtonPressed(DWORD index, ControllerButton btn) const;
bool IsControllerButtonReleased(DWORD index, ControllerButton btn) const;
bool IsControllerTriggerL(DWORD index) const;
bool IsControllerTriggerR(DWORD index) const;
math::vector2 GetControllerThumbL(DWORD index) const;
math::vector2 GetControllerThumbR(DWORD index) const;
void SetControllerVibration(DWORD Index, float leftMotorSpeed, float rightMotorSpeed, float lowFre, float highFre, float time);
void SetControllerVibration(DWORD Index, float leftMotorSpeed, float rightMotorSpeed, float lowFre, float highFre);
void UpdateControllerVibration(float tick);
void SetControllerVibrationTime(DWORD Index, float time);
math::vector4 vibrations[MAX_CONTROLLER]{};
public:
ComPtr<IGameInput> gameInput{};
KeyboardState m_keyboardState{};
IGameInputDevice* m_keyboardDevice{ nullptr };
std::vector<GameInputKeyState> m_GameInputKeyStates{};
GameInputMouseState m_GameInputMouseState{};
//ºñÆ® Ç÷¹±×ÀÇ Á¤¼ö¸¦ º¸¿©ÁÖÁö
KeyBitFlag m_curKeyStates{};
MouseBitFlag m_curMouseState{};
math::vector2 m_gameViewPos{};
math::vector2 m_gameViewSize{};
private:
HWND hwnd{};
//¸¶¿ì½º
MouseState m_mouseState{};
math::vector2 m_prevMousePos{};
math::vector2 m_mousePos{};
math::vector2 m_mouseDelta{};
//¸¶¿ì½º ÈÙ
int16 m_mouseWheelDelta{};
int16 m_prevMouseWheelDelta{};
//Ä¿¼ ¼û±â±â
bool m_isCursorHidden{ false };
public:
GameInputGamepadState m_GameInputPadState[MAX_CONTROLLER]{};
GamePadBitFlag m_curPadState[MAX_CONTROLLER]{};
//ÆÐµå ÃÖ¼Ú°ª
float deadZone = 0.24f;
float triggerdeadZone = 0.1f;
private:
IGameInputDevice* device[4]{};
PadState m_padState{};
math::vector2 m_controllerThumbL[MAX_CONTROLLER]{};
math::vector2 m_controllerThumbR[MAX_CONTROLLER]{};
float m_controllerTriggerL[MAX_CONTROLLER]{}; // ¿ÞÂÊ Æ®¸®°Å
float m_controllerTriggerR[MAX_CONTROLLER]{}; // ¿À¸¥ÂÊ Æ®¸®°Å
float m_controllerVibrationTime[MAX_CONTROLLER]{};
};
inline static auto InputManagement = InputManager::GetInstance();