Etterna 0.74.4
Loading...
Searching...
No Matches
ScreenMapControllers.h
1/* ScreenMapControllers - Maps device input to instrument buttons. */
2
3#ifndef SCREEN_MAP_CONTROLLERS_H
4#define SCREEN_MAP_CONTROLLERS_H
5
6#include "Etterna/Actor/Base/ActorScroller.h"
7#include "Etterna/Actor/Base/BitmapText.h"
8#include "Etterna/Singletons/InputMapper.h"
9#include "RageUtil/Sound/RageSound.h"
10#include "ScreenWithMenuElements.h"
11
12#include <set>
13
15{
16 public:
18 ~ScreenMapControllers() override;
19 void Init() override;
20 void BeginScreen() override;
21
22 void Update(float fDeltaTime) override;
23 bool Input(const InputEventPlus& input) override;
24 void HandleMessage(const Message& msg) override;
25 void HandleScreenMessage(const ScreenMessage& SM) override;
26
27 private:
28 Actor* GetActorWithFocus();
29 void BeforeChangeFocus();
30 void AfterChangeFocus();
31 void Refresh();
32 void DismissWarning();
33 bool CursorOnAction();
34 bool CursorOnHeader();
35 bool CursorOnKey();
36 bool CursorCanGoUp();
37 bool CursorCanGoDown();
38 bool CursorCanGoLeft();
39 bool CursorCanGoRight();
40 int CurKeyIndex();
41 int CurActionIndex();
42 void SetCursorFromSetListCurrent();
43 void StartWaitingForPress();
44
45 unsigned int m_CurController = 0;
46 unsigned int m_CurButton = 0;
47 unsigned int m_CurSlot = 0;
48 unsigned int m_MaxDestItem = 0;
49
50 bool m_ChangeOccurred;
51
52 RageTimer m_WaitingForPress;
53 DeviceInput m_DeviceIToMap;
54
55 struct KeyToMap
56 {
57 GameButton m_GameButton;
58
59 // owned by m_Line
60 BitmapText* m_textMappedTo[NUM_GameController]
61 [NUM_SHOWN_GAME_TO_DEVICE_SLOTS];
62 };
63 std::vector<KeyToMap> m_KeysToMap;
64
65 BitmapText m_textDevices;
66
67 BitmapText m_textLabel[NUM_GameController];
68 BitmapText m_ListHeaderCenter;
69 BitmapText m_ListHeaderLabels[NUM_GameController]
70 [NUM_SHOWN_GAME_TO_DEVICE_SLOTS];
71
72 float m_AutoDismissWarningSecs = 2.5f;
73 AutoActor m_Warning;
74
75 float m_AutoDismissNoSetListPromptSecs = 5.f;
76 AutoActor m_NoSetListPrompt;
77
78 float m_AutoDismissSanitySecs = 5.f;
79 AutoActor m_SanityMessage;
80
81 struct SetListEntry
82 {
83 int m_button;
84 int m_controller;
85 int m_slot;
86 SetListEntry(int b, int c, int s)
87 : m_button(b)
88 , m_controller(c)
89 , m_slot(s)
90 {
91 }
92 bool operator<(SetListEntry const& rhs) const
93 {
94 if (m_controller != rhs.m_controller) {
95 return m_controller < rhs.m_controller;
96 }
97 if (m_button != rhs.m_button) {
98 return m_button < rhs.m_button;
99 }
100 return m_slot < rhs.m_slot;
101 }
102 };
103 std::set<SetListEntry> m_SetList;
104 std::set<SetListEntry>::iterator m_SetListCurrent;
105 bool m_InSetListMode;
106
107 using action_fun_t = void (ScreenMapControllers::*)();
108 struct ActionRow
109 {
110 std::string m_name;
111 AutoActor m_actor;
112 action_fun_t m_action;
113 void Load(std::string const& scr_name,
114 std::string const& name,
115 ScreenMapControllers::action_fun_t action,
116 ActorFrame* line,
117 ActorScroller* scroller);
118 };
119 void ClearToDefault();
120 void ReloadFromDisk();
121 void SaveToDisk();
122 void SetListMode();
123 void ExitAction();
124 bool SanityCheckWrapper();
125
126 std::vector<ActionRow> m_Actions;
127
128 std::vector<ActorFrame*> m_Line;
129 ActorScroller m_LineScroller;
130
131 RageSound m_soundChange;
132 RageSound m_soundDelete;
133};
134
135#endif
A container for other Actors.
Definition ActorFrame.h:8
ActorFrame that moves its children.
Definition ActorScroller.h:10
Base class for all objects that appear on the screen.
Definition Actor.h:77
A smart pointer for Actor.
Definition AutoActor.h:13
An actor that holds a Font and draws text to the screen.
Definition BitmapText.h:11
Holds a device input plus Game/Menu translations.
Definition InputEventPlus.h:9
Definition RageSound.h:130
Definition RageTimer.h:9
Definition ScreenMapControllers.h:15
void BeginScreen() override
This is called immediately before the screen is used.
Definition ScreenMapControllers.cpp:245
void Init() override
This is called immediately after construction, to allow initializing after all derived classes exist.
Definition ScreenMapControllers.cpp:52
Definition ScreenWithMenuElements.h:12
Definition RageInputDevice.h:390
Definition MessageManager.h:96