mirror of
https://github.com/open-goal/jak-project
synced 2026-06-04 02:47:17 -04:00
6faa7530f9
The current event-based approach is very difficult to get right, and it depends on no events ever being missed. This changes the keyboard/mouse handling code to a polling-based approach. Other fixes: - an issue where modifier keys were not able to be successfully bound (like Left Shift to `X`) - improves cursor hiding (except when you use the start menu, this seems like an SDL issue, see comment) - Better discarding of kb/mouse inputs when imgui intercepts input - properly swap bindings when an already set key is assigned, even if it crosses the distinction of an analog vs normal button Fixes #2800
26 lines
751 B
C++
26 lines
751 B
C++
#pragma once
|
|
|
|
#include <optional>
|
|
|
|
#include "game/settings/settings.h"
|
|
#include "game/system/hid/input_bindings.h"
|
|
|
|
#include "third-party/SDL/include/SDL.h"
|
|
|
|
// A distinct input device. Only those devices that are "active" should be read
|
|
class InputDevice {
|
|
protected:
|
|
bool m_loaded = false;
|
|
std::shared_ptr<game_settings::InputSettings> m_settings;
|
|
|
|
public:
|
|
virtual ~InputDevice(){};
|
|
|
|
virtual void process_event(const SDL_Event& event,
|
|
const CommandBindingGroups& commands,
|
|
std::shared_ptr<PadData> data,
|
|
std::optional<InputBindAssignmentMeta>& bind_assignment) = 0;
|
|
virtual void close_device() = 0;
|
|
bool is_loaded() const { return m_loaded; };
|
|
};
|