CommonLibSSE (powerof3)
BSInputDevice.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSFixedString.h"
4 #include "RE/B/BSIInputDevice.h"
5 #include "RE/B/BSTHashMap.h"
6 #include "RE/I/InputDevices.h"
7 
8 namespace RE
9 {
11  {
12  public:
13  inline static constexpr auto RTTI = RTTI_BSInputDevice;
14  inline static constexpr auto VTABLE = VTABLE_BSInputDevice;
15 
16  struct InputButton
17  {
19  float heldDownSecs; // 08
20  std::uint32_t keycode; // 0C
21  };
22  static_assert(sizeof(InputButton) == 0x10);
23 
24  ~BSInputDevice() override; // 00
25 
26  // override (BSIInputDevice)
27  bool GetKeyMapping(std::uint32_t a_key, BSFixedString& a_mapping) override; // 04
28  std::uint32_t GetMappingKey(BSFixedString a_mapping) override; // 05
29  bool GetMappedKeycode(std::uint32_t a_key, std::uint32_t& outKeyCode) override; // 06
30  [[nodiscard]] bool IsEnabled() const override; // 07 - { return true; }
31 
32  [[nodiscard]] bool IsKeyboard() const;
33  [[nodiscard]] bool IsMouse() const;
34  [[nodiscard]] bool IsGamepad() const;
35  [[nodiscard]] bool IsPressed(std::uint32_t a_keyCode) const;
36 
37  bool LoadControlsDefinitionFile(const char* a_fileName); // loads the controls definition file from <FILENAME>.txt (usually located in 'interface\controls' folder)
38  void ResetButtonMaps(); // resets the button maps
39  void SetButtonState(std::uint32_t a_buttonId, float a_timeSinceLastPoll, bool a_buttonWasPressed, bool a_buttonIsPressed); // sets the button state for a given key code and emits a button event if necessary
40 
41  // members
43  std::uint32_t pad0C; // 0C
46  };
47  static_assert(sizeof(BSInputDevice) == 0x70);
48 }
Definition: BSIInputDevice.h:9
Definition: BSInputDevice.h:11
bool GetMappedKeycode(std::uint32_t a_key, std::uint32_t &outKeyCode) override
bool GetKeyMapping(std::uint32_t a_key, BSFixedString &a_mapping) override
bool IsEnabled() const override
std::uint32_t GetMappingKey(BSFixedString a_mapping) override
bool IsMouse() const
bool IsGamepad() const
std::uint32_t pad0C
Definition: BSInputDevice.h:43
bool IsKeyboard() const
static constexpr auto RTTI
Definition: BSInputDevice.h:13
bool IsPressed(std::uint32_t a_keyCode) const
~BSInputDevice() override
INPUT_DEVICE device
Definition: BSInputDevice.h:42
BSTHashMap< std::uint32_t, InputButton * > deviceButtons
Definition: BSInputDevice.h:44
BSTHashMap< BSFixedString, std::uint32_t > buttonNameIDMap
Definition: BSInputDevice.h:45
void SetButtonState(std::uint32_t a_buttonId, float a_timeSinceLastPoll, bool a_buttonWasPressed, bool a_buttonIsPressed)
bool LoadControlsDefinitionFile(const char *a_fileName)
static constexpr auto VTABLE
Definition: BSInputDevice.h:14
Definition: BSTHashMap.h:21
Definition: AbsorbEffect.h:6
constexpr REL::ID RTTI_BSInputDevice(static_cast< std::uint64_t >(690308))
constexpr std::array< REL::ID, 1 > VTABLE_BSInputDevice
Definition: Offsets_VTABLE.h:9187
Definition: BSInputDevice.h:17
BSFixedString name
Definition: BSInputDevice.h:18
float heldDownSecs
Definition: BSInputDevice.h:19
std::uint32_t keycode
Definition: BSInputDevice.h:20
INPUT_DEVICE
Definition: InputDevices.h:8