Etterna 0.74.4
Loading...
Searching...
No Matches
InputQueue.h
1#ifndef INPUT_QUEUE_H
2#define INPUT_QUEUE_H
3
4#include "Etterna/Models/Misc/GameInput.h"
5#include "InputFilter.h"
6
7#include <chrono>
8
10
14{
15 public:
16 InputQueue();
17
18 void RememberInput(const InputEventPlus& gi);
19 bool WasPressedRecently(
20 GameController c,
21 GameButton button,
22 const std::chrono::steady_clock::time_point& OldestTimeAllowed,
23 InputEventPlus* pIEP = nullptr);
24
25 [[nodiscard]] const std::vector<InputEventPlus>& GetQueue(
26 GameController c) const
27 {
28 return m_aQueue[c];
29 }
30 void ClearQueue(GameController c);
31
32 protected:
33 std::vector<InputEventPlus> m_aQueue[NUM_GameController];
34};
35
37{
38 bool Load(std::string sButtonsNames);
39 [[nodiscard]] bool EnteredCode(GameController controller) const;
40
42
43 private:
44 struct ButtonPress
45 {
46 ButtonPress()
47 {
48 memset(m_InputTypes, 0, sizeof(m_InputTypes));
49 m_InputTypes[IET_FIRST_PRESS] = true;
50 }
51 std::vector<GameButton> m_aButtonsToHold;
52 std::vector<GameButton> m_aButtonsToNotHold;
53 std::vector<GameButton> m_aButtonsToPress;
54
55 bool m_InputTypes[NUM_InputEventType]{};
56 bool m_bAllowIntermediatePresses{ false };
57 };
58 std::vector<ButtonPress> m_aPresses;
59
60 float m_fMaxSecondsBack = 0.f;
61};
62
63extern InputQueue*
64 INPUTQUEUE; // global and accessible from anywhere in our program
65
66#endif
Holds a device input plus Game/Menu translations.
Definition InputEventPlus.h:9
Stores a list of the most recently pressed MenuInputs for each player.
Definition InputQueue.h:14
Definition InputQueue.h:37