input: Don't use old input state in GameController::ReadState() (#2170)

This commit is contained in:
Quang Ngô 2025-01-18 13:59:38 +07:00 committed by GitHub
parent 7b8177f48e
commit 90b04e8cc0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 340 additions and 131 deletions

View file

@ -5,14 +5,32 @@
#include <string>
#include "common/types.h"
#include "input/controller.h"
struct SDL_Window;
struct SDL_Gamepad;
union SDL_Event;
namespace Input {
class GameController;
}
class SDLInputEngine : public Engine {
public:
~SDLInputEngine() override;
void Init() override;
void SetLightBarRGB(u8 r, u8 g, u8 b) override;
void SetVibration(u8 smallMotor, u8 largeMotor) override;
float GetGyroPollRate() const override;
float GetAccelPollRate() const override;
State ReadState() override;
private:
SDL_Gamepad* m_gamepad = nullptr;
float m_gyro_poll_rate{};
float m_accel_poll_rate{};
};
} // namespace Input
namespace Frontend {