mirror of
https://github.com/elasota/Aerofoil.git
synced 2025-09-23 06:53:43 +00:00
XInput support
This commit is contained in:
32
GpInputDriver_XInput/GpInputDriverXInput.h
Normal file
32
GpInputDriver_XInput/GpInputDriverXInput.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "IGpInputDriver.h"
|
||||
#include "GpInputDriverProperties.h"
|
||||
#include "GpVOSEvent.h"
|
||||
#include "GpWindows.h"
|
||||
|
||||
#include <Xinput.h>
|
||||
|
||||
class GpInputDriverXInput final : public IGpInputDriver
|
||||
{
|
||||
public:
|
||||
void ProcessInput() override;
|
||||
void Shutdown() override;
|
||||
|
||||
static GpInputDriverXInput *Create(const GpInputDriverProperties &props);
|
||||
|
||||
private:
|
||||
GpInputDriverXInput(const GpInputDriverProperties &props);
|
||||
~GpInputDriverXInput();
|
||||
|
||||
void ProcessControllerStateChange(unsigned int playerNumber, const XINPUT_STATE &prevState, const XINPUT_STATE &newState);
|
||||
void ProcessButtonStateChange(DWORD prevState, DWORD newState, DWORD deltaBit, unsigned int playerNum, GpGamepadButton_t gamepadButton);
|
||||
void ProcessAxisStateChange(int16_t prevState, int16_t newState, unsigned int playerNum, GpGamepadAxis_t gamepadAxis);
|
||||
|
||||
static int16_t ConvertTriggerValue(uint8_t v);
|
||||
|
||||
GpInputDriverProperties m_properties;
|
||||
int m_xUserToPlayerNumber[XUSER_MAX_COUNT];
|
||||
bool m_playerNumberIsConnected[XUSER_MAX_COUNT];
|
||||
XINPUT_STATE m_controllerStates[XUSER_MAX_COUNT];
|
||||
};
|
Reference in New Issue
Block a user