1
0
mirror of https://github.com/cathery/sys-con.git synced 2024-07-05 10:48:46 +00:00
sys-con/source/ControllerLib/IController.h
cathery fb578f6987 Change controller config options
Allow unmapping keys
Allow mapping multiple keys to the same button
Allow changing the deadzone for each trigger
Remove dualshock4 global option from the config files

Update config files for new changes
2020-12-07 15:03:35 +03:00

42 lines
1.1 KiB
C++

#pragma once
#include "IUSBDevice.h"
#include "ControllerTypes.h"
#include "ControllerConfig.h"
#include <memory>
struct NormalizedButtonData
{
bool buttons[MAX_CONTROLLER_BUTTONS];
float triggers[2];
NormalizedStick sticks[2];
};
class IController
{
protected:
std::unique_ptr<IUSBDevice> m_device;
public:
IController(std::unique_ptr<IUSBDevice> &&interface) : m_device(std::move(interface))
{
}
virtual ~IController() = default;
virtual Result Initialize() = 0;
//Since Exit is used to clean up resources, no Result report should be needed
virtual void Exit() = 0;
virtual Result GetInput() { return 1; }
virtual NormalizedButtonData GetNormalizedButtonData() { return NormalizedButtonData(); }
inline IUSBDevice *GetDevice() { return m_device.get(); }
virtual ControllerType GetType() = 0;
virtual Result SetRumble(uint8_t strong_magnitude, uint8_t weak_magnitude) { return 1; }
virtual bool IsControllerActive() { return true; }
virtual Result OutputBuffer() { return 1; };
virtual ControllerConfig *GetConfig() { return nullptr; }
};