Etterna 0.75.1
Loading...
Searching...
No Matches
ScreenManager.h
1#ifndef SCREEN_MANAGER_H
2#define SCREEN_MANAGER_H
3
4#include "Etterna/Models/Misc/PlayerNumber.h"
5#include "RageUtil/Sound/RageSound.h"
6#include "Etterna/Screen/Others/ScreenMessage.h"
7
8class Actor;
9class Screen;
10struct Menu;
11struct lua_State;
12class InputEventPlus;
15{
16 public:
19
20 // pass these messages along to the current state
21 void Update(float fDeltaTime);
22 void Draw();
23 void Input(const InputEventPlus& input);
24
25 // Main screen stack management
26 void SetNewScreen(const std::string& sName);
27 void AddNewScreenToTop(const std::string& sName,
28 ScreenMessage SendOnPop = SM_None);
35 void PrepareScreen(const std::string& sScreenName);
36 void GroupScreen(const std::string& sScreenName);
37 void PersistantScreen(const std::string& sScreenName);
38 void PopTopScreen(ScreenMessage SM);
39 void PopAllScreens();
40 auto GetTopScreen() -> Screen*;
41 auto GetScreen(int iPosition) -> Screen*;
42 auto GetOverlayScreens() -> std::vector<Screen*>;
43 auto AllowOperatorMenuButton() const -> bool;
44
45 auto IsScreenNameValid(std::string const& name) const -> bool;
46
47 // System messages
48 void SystemMessage(const std::string& sMessage);
49 void SystemMessageNoAnimate(const std::string& sMessage);
50 void HideSystemMessage();
51
52 // Screen messages
53 void PostMessageToTopScreen(ScreenMessage SM, float fDelay);
54 void SendMessageToTopScreen(ScreenMessage SM);
55
56 void RefreshCreditsMessages();
57 void ThemeChanged();
58 void ReloadOverlayScreens();
59 void ReloadOverlayScreensAfterInputFinishes();
60
70 auto IsStackedScreen(const Screen* pScreen) const -> bool;
71
72 auto get_input_redirected(PlayerNumber pn) -> bool;
73 void set_input_redirected(PlayerNumber pn, bool redir);
74
75 // Lua
76 void PushSelf(lua_State* L);
77
78 void PlaySharedBackgroundOffCommand();
79 void ZeroNextUpdate();
80
81 private:
82 // Screen loads, removals, and concurrent prepares are delayed until the
83 // next update.
84 std::string m_sDelayedScreen;
85 std::string m_sDelayedConcurrentPrepare;
86 ScreenMessage m_OnDonePreparingScreen;
87 ScreenMessage m_PopTopScreen;
88
89 // Set this to true anywhere we create of delete objects. These
90 // operations take a long time, and will cause a skip on the next update.
91 bool m_bZeroNextUpdate;
92
93 // This exists so the debug overlay can reload the overlay screens without
94 // seg faulting. It's "AfterInput" because the debug overlay carries out
95 // actions in Input.
96 bool m_bReloadOverlayScreensAfterInput;
97
98 // m_input_redirected exists to allow the theme to prevent input being
99 // passed to the normal Screen::Input function, on a per-player basis.
100 // Input is still passed to lua callbacks, so it's intended for the case
101 // where someone has a custom menu on a screen and needs to disable normal
102 // input for navigating the custom menu to work. -Kyz
103 std::vector<bool> m_input_redirected;
104
105 auto MakeNewScreen(const std::string& sName) -> Screen*;
106 void LoadDelayedScreen();
107 auto ActivatePreparedScreenAndBackground(const std::string& sScreenName)
108 -> bool;
109 auto PopTopScreenInternal(bool bSendLoseFocus = true) -> ScreenMessage;
110
111 // Keep these sounds always loaded, because they could be
112 // played at any time. We want to eliminate SOUND->PlayOnce
113 public:
114 void PlayStartSound();
115 void PlayCoinSound();
116 void PlayCancelSound();
117 void PlayInvalidSound();
118 void PlayScreenshotSound();
119
120 private:
121 RageSound m_soundStart;
123 RageSound m_soundCoin;
124 RageSound m_soundCancel;
125 RageSound m_soundInvalid;
128 RageSound m_soundScreenshot;
129};
130
131extern ScreenManager*
132 SCREENMAN; // global and accessible from anywhere in our program
133
134#endif
Base class for all objects that appear on the screen.
Definition Actor.h:78
Holds a device input plus Game/Menu translations.
Definition InputEventPlus.h:9
Definition RageSound.h:135
Manager/container for Screens.
Definition ScreenManager.h:15
auto IsStackedScreen(const Screen *pScreen) const -> bool
Is this Screen in the main Screen stack, but not the bottommost Screen?
Definition ScreenManager.cpp:383
void PrepareScreen(const std::string &sScreenName)
Create and cache the requested Screen.
Definition ScreenManager.cpp:615
Class that holds a screen-full of Actors.
Definition Screen.h:64