mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-08-13 17:03:47 -04:00
fa8d64ec3a
* Disable game input when typing into a textfield * Only block keyboard input when typing in textfield * Address PR comments * Fix spacing * Generalize check on input device Co-authored-by: Garrett Cox <garrettjcox@gmail.com>
33 lines
976 B
C++
33 lines
976 B
C++
#pragma once
|
|
|
|
#include "Controller.h"
|
|
#include <vector>
|
|
#include "Lib/Mercury/Mercury.h"
|
|
|
|
namespace Ship {
|
|
|
|
class ControlDeck {
|
|
public:
|
|
void Init(uint8_t* controllerBits);
|
|
void ScanPhysicalDevices();
|
|
void WriteToPad(OSContPad* pad) const;
|
|
void LoadControllerSettings();
|
|
void SaveControllerSettings();
|
|
void SetPhysicalDevice(int32_t slot, int32_t deviceSlot);
|
|
std::shared_ptr<Controller> GetPhysicalDevice(int32_t deviceSlot);
|
|
std::shared_ptr<Controller> GetPhysicalDeviceFromVirtualSlot(int32_t slot);
|
|
size_t GetNumPhysicalDevices();
|
|
int32_t GetVirtualDevice(int32_t slot);
|
|
size_t GetNumVirtualDevices();
|
|
uint8_t* GetControllerBits();
|
|
void BlockGameInput();
|
|
void UnblockGameInput();
|
|
bool ShouldBlockGameInput(std::string inputDeviceGuid) const;
|
|
private:
|
|
std::vector<int32_t> virtualDevices = {};
|
|
std::vector<std::shared_ptr<Controller>> physicalDevices = {};
|
|
uint8_t* controllerBits = nullptr;
|
|
bool shouldBlockGameInput = false;
|
|
};
|
|
}
|