From 7016f7312811abfea41b52e08d3480726cc8a020 Mon Sep 17 00:00:00 2001 From: zsccat Date: Thu, 4 Jun 2020 12:58:36 +0000 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=20'source-code/source/plugin?= =?UTF-8?q?s/TLAC/Input/DirectInput/GenericUsbInput.h'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TLAC/Input/DirectInput/GenericUsbInput.h | 53 ------------------- 1 file changed, 53 deletions(-) delete mode 100644 source-code/source/plugins/TLAC/Input/DirectInput/GenericUsbInput.h diff --git a/source-code/source/plugins/TLAC/Input/DirectInput/GenericUsbInput.h b/source-code/source/plugins/TLAC/Input/DirectInput/GenericUsbInput.h deleted file mode 100644 index 898b7ce..0000000 --- a/source-code/source/plugins/TLAC/Input/DirectInput/GenericUsbInput.h +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once -#include "../Controller.h" -#include "../../IInputDevice.h" -#include "GuState.h" - -namespace TLAC::Input -{ - class GenericUsbInput : public Controller, public IInputDevice - { - public: - GenericUsbInput(); - ~GenericUsbInput(); - - static bool TryInitializeInstance(); - - bool Initialize(); - bool PollInput() override; - - bool IsDown(GuButton button); - bool IsUp(GuButton button); - bool IsTapped(GuButton button); - bool IsReleased(GuButton button); - bool WasDown(GuButton button); - bool WasUp(GuButton button); - - inline GuJoystick GetLeftStick() { return currentState.LeftStick; }; - inline GuJoystick GetRightStick() { return currentState.RightStick; }; - inline GuJoystick GetDpad() { return currentState.Dpad.Stick; }; - - static inline bool InstanceInitialized() { return instance != nullptr; }; - static inline GenericUsbInput* GetInstance() { return instance; }; - static inline void DeleteInstance() { delete instance; instance = nullptr; }; - - private: - static GenericUsbInput* instance; - - GuState lastState; - GuState currentState; - - const float triggerThreshold = 0.5f; - const float joystickThreshold = 0.5f; - const float dpadThreshold = 0.5f; - - inline float NormalizeTrigger(long value) { return (float)value / USHRT_MAX; }; - inline float NormalizeStick(long value) { return (float)value / USHRT_MAX * 2.0f - 1.0f; }; - inline GuJoystick NormalizeStick(long x, long y) { return GuJoystick(NormalizeStick(x), NormalizeStick(y)); }; - - void UpdateInternalGuState(GuState &state); - - bool MatchesDirection(GuJoystick joystick, GuDirection directionEnum, float threshold); - bool GetButtonState(GuState &state, GuButton button); - }; -} \ No newline at end of file