|
VoltMod
C++23 framework for CS2 server plugins
|
Create Screen objects and report their button presses. More...
#include <ScreenManager.hpp>
Public Types | |
| using | Connector = std::function< Subscription(ScreenManager &)> |
Public Member Functions | |
| ScreenManager (EntitySystem &entities, const Bindings &bindings, SlotEvents &slots, Visibility &visibility, Connector connect) | |
| ScreenManager (const ScreenManager &)=delete | |
| ScreenManager & | operator= (const ScreenManager &)=delete |
| Status | Available () const |
| Result< Screen > | Shared (std::string_view layout) |
| Result< Screen > | ForPlayer (std::string_view layout, int slot) |
| void | OnPress (int slot, std::string_view buttonId) |
Public Attributes | |
| Event< const ButtonPress & > | Pressed |
Create Screen objects and report their button presses.
layout must be a bare name ("welcome") or a resource name under panorama/layout/custom_game/ with its source .xml extension. Other forms are rejected before reaching the client.
Definition at line 25 of file ScreenManager.hpp.
| using VoltMod::ScreenManager::Connector = std::function<Subscription(ScreenManager&)> |
Subscribes a ScreenManager to the host's button presses; dropping the result unsubscribes.
Definition at line 29 of file ScreenManager.hpp.
| VoltMod::ScreenManager::ScreenManager | ( | EntitySystem & | entities, |
| const Bindings & | bindings, | ||
| SlotEvents & | slots, | ||
| Visibility & | visibility, | ||
| Connector | connect | ||
| ) |
The services must outlive this one; connect runs when the first press handler arrives.
Definition at line 15 of file ScreenManager.cpp.
References VoltMod::Subscription::Reset().
|
delete |
| Status VoltMod::ScreenManager::Available | ( | ) | const |
Return the reason screens are unavailable, or success when all required bindings exist.
Definition at line 62 of file ScreenManager.cpp.
References VoltMod::Visibility::Available(), VoltMod::Bindings::ClientMessageFilter, VoltMod::Bindings::ClientSlot, VoltMod::Bindings::CustomHudSetDialogVariable, VoltMod::Bindings::CustomHudSetDialogVariableForPlayer, VoltMod::Bindings::CustomHudSetHasClass, VoltMod::Bindings::CustomHudSetHasClassForPlayer, VoltMod::Bindings::CustomHudSetInputCapture, VoltMod::Bindings::FilterMessage, VoltMod::ReadFile(), and VoltMod::Error::Unsupported().
Referenced by VoltMod::PanoramaMenu::CanShow().
A screen only slot receives, removed when the slot changes hands. This requires Visibility::Available because otherwise the entity would reach everyone.
Definition at line 46 of file ScreenManager.cpp.
References VoltMod::Visibility::Available(), VoltMod::Error::Invalid(), VoltMod::IsValidSlot(), VoltMod::ReadFile(), and VoltMod::Error::Unsupported().
Referenced by VoltMod::PlayerScreens::For().
Definition at line 36 of file ScreenManager.cpp.
References Pressed, and VoltMod::ReadFile().
|
delete |
A screen every player receives. Spawned on its first Screen::EnsureSpawned.
Definition at line 41 of file ScreenManager.cpp.
References VoltMod::EveryoneSlot, and VoltMod::ReadFile().
| Event<const ButtonPress&> VoltMod::ScreenManager::Pressed |
Every button press from every layout; filter on ButtonPress::ButtonId. A subscription is refused when the FilterMessage bindings are missing.
Definition at line 52 of file ScreenManager.hpp.
Referenced by OnPress(), and VoltMod::PanoramaMenu::PanoramaMenu().