9 InputCallbacks(gainput::InputManager& manager,
int index) : manager(manager), index(index) { }
11 bool OnDeviceButtonBool(gainput::DeviceId deviceId, gainput::DeviceButtonId deviceButton,
bool oldValue,
bool newValue)
override 13 const gainput::InputDevice* device = manager.GetDevice(deviceId);
14 char buttonName[64] =
"";
15 device->GetButtonName(deviceButton, buttonName, 64);
20 io.
KeysDown[deviceButton] = newValue;
22 if (deviceButton == gainput::KeyCtrlL || deviceButton == gainput::KeyCtrlR)
25 if (deviceButton == gainput::KeyAltL || deviceButton == gainput::KeyAltR)
28 if (deviceButton == gainput::KeyShiftL || deviceButton == gainput::KeyShiftR)
31 if (deviceButton == gainput::KeySuperL || deviceButton == gainput::KeySuperR)
38 if (deviceButton == gainput::MouseButton3)
43 else if (deviceButton == gainput::MouseButton4)
55 bool OnDeviceButtonFloat(gainput::DeviceId deviceId, gainput::DeviceButtonId deviceButton,
float oldValue,
float newValue)
override 60 if (deviceButton == gainput::MouseAxisX)
64 else if (deviceButton == gainput::MouseAxisY)
80 gainput::InputManager& manager;
86 InputManager::InputManager() noexcept : inputManager()
88 inputManager.SetDisplaySize(Engine::GetEngine().lock()->GetWindow().lock()->GetWidth(), Engine::GetEngine().lock()->GetWindow().lock()->GetHeight());
90 mouseId = inputManager.CreateDevice<gainput::InputDeviceMouse>();
91 keyboardId = inputManager.CreateDevice<gainput::InputDeviceKeyboard>();
92 gamepadId = inputManager.CreateDevice<gainput::InputDevicePad>();
117 gainput::InputManager& InputManager::GetInputManager()
122 eastl::vector<gainput::DeviceButtonId> InputManager::GetAllKeysDown(gainput::DeviceId deviceId)
124 eastl::vector<gainput::DeviceButtonId> specToReturn(512,
false);
126 for (
int i = 0; i < gainput::KeyCount_; ++i)
128 bool value = inputManager.GetDevice(deviceId)->GetBool(i);
129 specToReturn[i] = value;
135 const gainput::DeviceId& InputManager::GetMouseId()
const 140 const gainput::DeviceId& InputManager::GetKeyboardId()
const 145 const gainput::DeviceId& InputManager::GetGamepadId()
const 152 return inputDefaults;
155 void InputManager::Update() noexcept
157 inputManager.Update();
160 while (PeekMessage(&message, Engine::GetEngine().lock()->GetWindow().lock()->GetWindowHandle(), 0, 0, PM_REMOVE))
162 TranslateMessage(&message);
163 DispatchMessage(&message);
165 inputManager.HandleMessage(message);
167 if (message.message == WM_CHAR)
169 const WPARAM key = message.wParam;
IMGUI_API void AddInputCharacter(ImWchar c)
int KeyMap[ImGuiKey_COUNT]
IMGUI_API ImGuiIO & GetIO()
static eastl::weak_ptr< Engine > GetEngine() noexcept
This method allows you to get the instance of the Engine. This method will automatically initialize t...