Etterna 0.74.4
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 AllowOperatorMenuButton() const -> bool;
43
44 auto IsScreenNameValid(std::string const& name) const -> bool;
45
46 // System messages
47 void SystemMessage(const std::string& sMessage);
48 void SystemMessageNoAnimate(const std::string& sMessage);
49 void HideSystemMessage();
50
51 // Screen messages
52 void PostMessageToTopScreen(ScreenMessage SM, float fDelay);
53 void SendMessageToTopScreen(ScreenMessage SM);
54
55 void RefreshCreditsMessages();
56 void ThemeChanged();
57 void ReloadOverlayScreens();
58 void ReloadOverlayScreensAfterInputFinishes();
59
69 auto IsStackedScreen(const Screen* pScreen) const -> bool;
70
71 auto get_input_redirected(PlayerNumber pn) -> bool;
72 void set_input_redirected(PlayerNumber pn, bool redir);
73
74 // Lua
75 void PushSelf(lua_State* L);
76
77 void PlaySharedBackgroundOffCommand();
78 void ZeroNextUpdate();
79
80 private:
81 // Screen loads, removals, and concurrent prepares are delayed until the
82 // next update.
83 std::string m_sDelayedScreen;
84 std::string m_sDelayedConcurrentPrepare;
85 ScreenMessage m_OnDonePreparingScreen;
86 ScreenMessage m_PopTopScreen;
87
88 // Set this to true anywhere we create of delete objects. These
89 // operations take a long time, and will cause a skip on the next update.
90 bool m_bZeroNextUpdate;
91
92 // This exists so the debug overlay can reload the overlay screens without
93 // seg faulting. It's "AfterInput" because the debug overlay carries out
94 // actions in Input.
95 bool m_bReloadOverlayScreensAfterInput;
96
97 // m_input_redirected exists to allow the theme to prevent input being
98 // passed to the normal Screen::Input function, on a per-player basis.
99 // Input is still passed to lua callbacks, so it's intended for the case
100 // where someone has a custom menu on a screen and needs to disable normal
101 // input for navigating the custom menu to work. -Kyz
102 std::vector<bool> m_input_redirected;
103
104 auto MakeNewScreen(const std::string& sName) -> Screen*;
105 void LoadDelayedScreen();
106 auto ActivatePreparedScreenAndBackground(const std::string& sScreenName)
107 -> bool;
108 auto PopTopScreenInternal(bool bSendLoseFocus = true) -> ScreenMessage;
109
110 // Keep these sounds always loaded, because they could be
111 // played at any time. We want to eliminate SOUND->PlayOnce
112 public:
113 void PlayStartSound();
114 void PlayCoinSound();
115 void PlayCancelSound();
116 void PlayInvalidSound();
117 void PlayScreenshotSound();
118
119 private:
120 RageSound m_soundStart;
122 RageSound m_soundCoin;
123 RageSound m_soundCancel;
124 RageSound m_soundInvalid;
127 RageSound m_soundScreenshot;
128};
129
130extern ScreenManager*
131 SCREENMAN; // global and accessible from anywhere in our program
132
133#endif
Base class for all objects that appear on the screen.
Definition Actor.h:77
Holds a device input plus Game/Menu translations.
Definition InputEventPlus.h:9
Definition RageSound.h:130
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:376
void PrepareScreen(const std::string &sScreenName)
Create and cache the requested Screen.
Definition ScreenManager.cpp:608
Class that holds a screen-full of Actors.
Definition Screen.h:64