mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-08-13 17:03:47 -04:00
219804cbe4
* Initial controller hud ui * Reverted fbdemo changes * Moved config to json and implemented controller config * fix build on linux, gitignore new config file * fix build * Fix compilation and file directory paths * Call save on cvar save * Fixed cvar loading and added deck slots to the config * Changed control deck port 0 to use a physical device by default * Added gyro and rumble & fixed loading errors * Save config on toggle menubar * fix linux build * Fixed drift calculation * Controller config now saves when pressing F1 * Removed ExitGame hook from ImGuiImpl * Moved mappings to a map * Added GetKeyName * untranslate scancodes * Fixed hud layout on keyboard device * Fixed keyboard read on hud * Fixed crash when reloading controllers * Removed ConfigFile and changed file extension * Changed Dummy to Disconnected and fixed filters * Removed function leftover * Changed ControllerHud to InputEditor Co-authored-by: briaguya <briaguya@alice> Co-authored-by: David Chavez <david@dcvz.io>
39 lines
1003 B
C++
39 lines
1003 B
C++
#pragma once
|
|
#include "Controller.h"
|
|
#include <string>
|
|
|
|
namespace Ship {
|
|
class KeyboardController : public Controller {
|
|
public:
|
|
KeyboardController();
|
|
|
|
void ReadFromSource(int32_t slot) override;
|
|
void WriteToSource(int32_t slot, ControllerCallback* controller) override;
|
|
bool Connected() const override { return true; }
|
|
bool CanRumble() const override { return false; }
|
|
bool CanGyro() const override { return false; }
|
|
const char* GetControllerName() override;
|
|
const char* GetButtonName(int slot, int n64Button) override;
|
|
bool PressButton(int32_t dwScancode);
|
|
bool ReleaseButton(int32_t dwScancode);
|
|
|
|
void ClearRawPress() override {
|
|
lastKey = -1;
|
|
}
|
|
|
|
int32_t ReadRawPress() override;
|
|
void ReleaseAllButtons();
|
|
|
|
void SetLastScancode(int32_t key) {
|
|
lastScancode = key;
|
|
}
|
|
|
|
int32_t GetLastScancode() { return lastScancode; }
|
|
void CreateDefaultBinding(int32_t slot) override;
|
|
|
|
protected:
|
|
int32_t lastScancode;
|
|
int32_t lastKey = -1;
|
|
};
|
|
}
|