CommonLibVR
Loading...
Searching...
No Matches
BSInputEventQueue.h
Go to the documentation of this file.
1#pragma once
2
3#include "RE/B/BSTSingleton.h"
4#include "RE/B/ButtonEvent.h"
5#include "RE/C/CharEvent.h"
7#include "RE/K/KinectEvent.h"
12
13namespace RE
14{
15 class BSInputEventQueue : public BSTSingletonSDM<BSInputEventQueue>
16 {
17 public:
18 inline static constexpr std::uint8_t MAX_BUTTON_EVENTS = 10;
19 inline static constexpr std::uint8_t MAX_CHAR_EVENTS = 5;
20 inline static constexpr std::uint8_t MAX_MOUSE_EVENTS = 1;
21 inline static constexpr std::uint8_t MAX_THUMBSTICK_EVENTS = 2;
22 inline static constexpr std::uint8_t MAX_CONNECT_EVENTS = 1;
23 inline static constexpr std::uint8_t MAX_KINECT_EVENTS = 1;
24#ifdef SKYRIMVR
25 inline static constexpr std::uint8_t MAX_VR_TOUCHPAD_POSITION_EVENTS = 3;
26 inline static constexpr std::uint8_t MAX_VR_TOUCHPAD_SWIPE_EVENTS = 3;
27#endif
28
30
31 template <class T>
33
34 template <class T>
36
37 template <class T, class... Args>
38 void AddEvent(Args&&... args)
39 {
40 if (auto cachedEvent = GetCachedEvent<T>()) {
41 cachedEvent->Init(std::forward<Args>(args)...);
42 PushOntoInputQueue(cachedEvent);
43 AdvanceCount<T>();
44 }
45 }
46
47 template <class... Args>
48 void AddButtonEvent(Args&&... args)
49 {
50 AddEvent<ButtonEvent>(std::forward<Args>(args)...);
51 }
52
53 template <class... Args>
54 void AddCharEvent(Args&&... args)
55 {
56 AddEvent<CharEvent>(std::forward<Args>(args)...);
57 }
58
59 template <class... Args>
60 void AddMouseMoveEvent(Args&&... args)
61 {
62 AddEvent<MouseMoveEvent>(std::forward<Args>(args)...);
63 }
64
65 template <class... Args>
66 void AddThumbstickEvent(Args&&... args)
67 {
68 AddEvent<ThumbstickEvent>(std::forward<Args>(args)...);
69 }
70
71 template <class... Args>
72 void AddConnectEvent(Args&&... args)
73 {
74 AddEvent<DeviceConnectEvent>(std::forward<Args>(args)...);
75 }
76
77 template <class... Args>
78 void AddKinectEvent(Args&&... args)
79 {
80 AddEvent<KinectEvent>(std::forward<Args>(args)...);
81 }
82
85
86 // members
87 std::uint8_t pad001; // 001
88 std::uint16_t pad002; // 002
89 std::uint32_t buttonEventCount; // 004
90 std::uint32_t charEventCount; // 008
91 std::uint32_t mouseEventCount; // 00C
92 std::uint32_t thumbstickEventCount; // 010
93 std::uint32_t connectEventCount; // 014
94 std::uint32_t kinectEventCount; // 018
95#ifndef SKYRIMVR
96 std::uint32_t pad01C; // 01C
97#else
98 std::uint32_t unkVR01C;
99 std::uint32_t vrTouchpadPositionEventCount;
100 std::uint32_t vrTouchpadSwipeEventCount;
101#endif
108#ifdef SKYRIMVR
109 VrWandTouchpadPositionEvent vrTouchpadPositionEvents[MAX_VR_TOUCHPAD_POSITION_EVENTS];
110 VrWandTouchpadSwipeEvent vrTouchpadSwipeEvents[MAX_VR_TOUCHPAD_SWIPE_EVENTS];
111#endif
114 private:
116 };
117#ifndef SKYRIMVR
118 static_assert(sizeof(BSInputEventQueue) == 0x390);
119#else
120 static_assert(sizeof(BSInputEventQueue) == 0x580);
121#endif
122}
#define KEEP_FOR_RE()
Definition PCH.h:517
Definition BSInputEventQueue.h:16
KinectEvent kinectEvents[MAX_KINECT_EVENTS]
Definition BSInputEventQueue.h:107
void AddButtonEvent(Args &&... args)
Definition BSInputEventQueue.h:48
std::uint32_t kinectEventCount
Definition BSInputEventQueue.h:94
std::uint32_t buttonEventCount
Definition BSInputEventQueue.h:89
void AddKinectEvent(Args &&... args)
Definition BSInputEventQueue.h:78
static constexpr std::uint8_t MAX_MOUSE_EVENTS
Definition BSInputEventQueue.h:20
static constexpr std::uint8_t MAX_BUTTON_EVENTS
Definition BSInputEventQueue.h:18
void AddEvent(Args &&... args)
Definition BSInputEventQueue.h:38
std::uint8_t pad001
Definition BSInputEventQueue.h:87
void AddConnectEvent(Args &&... args)
Definition BSInputEventQueue.h:72
static BSInputEventQueue * GetSingleton()
InputEvent * queueTail
Definition BSInputEventQueue.h:113
void AddCharEvent(Args &&... args)
Definition BSInputEventQueue.h:54
std::uint32_t charEventCount
Definition BSInputEventQueue.h:90
void AddMouseMoveEvent(Args &&... args)
Definition BSInputEventQueue.h:60
std::uint32_t pad01C
Definition BSInputEventQueue.h:96
CharEvent charEvents[MAX_CHAR_EVENTS]
Definition BSInputEventQueue.h:103
static constexpr std::uint8_t MAX_CHAR_EVENTS
Definition BSInputEventQueue.h:19
MouseMoveEvent mouseEvents[MAX_MOUSE_EVENTS]
Definition BSInputEventQueue.h:104
void AddThumbstickEvent(Args &&... args)
Definition BSInputEventQueue.h:66
std::uint16_t pad002
Definition BSInputEventQueue.h:88
static constexpr std::uint8_t MAX_KINECT_EVENTS
Definition BSInputEventQueue.h:23
std::uint32_t connectEventCount
Definition BSInputEventQueue.h:93
std::uint32_t mouseEventCount
Definition BSInputEventQueue.h:91
ThumbstickEvent thumbstickEvents[MAX_THUMBSTICK_EVENTS]
Definition BSInputEventQueue.h:105
void PushOntoInputQueue(InputEvent *a_event)
InputEvent * queueHead
Definition BSInputEventQueue.h:112
DeviceConnectEvent connectEvents[MAX_CONNECT_EVENTS]
Definition BSInputEventQueue.h:106
static constexpr std::uint8_t MAX_THUMBSTICK_EVENTS
Definition BSInputEventQueue.h:21
ButtonEvent buttonEvents[MAX_BUTTON_EVENTS]
Definition BSInputEventQueue.h:102
static constexpr std::uint8_t MAX_CONNECT_EVENTS
Definition BSInputEventQueue.h:22
std::uint32_t thumbstickEventCount
Definition BSInputEventQueue.h:92
Definition ButtonEvent.h:16
Definition CharEvent.h:8
Definition DeviceConnectEvent.h:8
Definition InputEvent.h:25
Definition KinectEvent.h:9
Definition MouseMoveEvent.h:8
Definition ThumbstickEvent.h:8
Definition VrWandTouchpadPositionEvent.h:8
Definition VrWandTouchpadSwipeEvent.h:8
Definition AbsorbEffect.h:6
Definition BSTSingleton.h:50