|
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, const NetChannels &clients, Connector connect) | |
| ScreenManager (const ScreenManager &)=delete | |
| ScreenManager & | operator= (const ScreenManager &)=delete |
| Status | Available () const |
| Result< Screen > | Create (std::string_view layout, int slot) |
| bool | HasCursor (int slot) const |
| void | OnPress (int slot, std::string_view buttonId) |
Public Attributes | |
| Event< const ButtonPress & > | Pressed |
Create Screen objects and report their button presses.
Every screen belongs to one player: a screen everyone received would send each player's state to every client. 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 28 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 32 of file ScreenManager.hpp.
| VoltMod::ScreenManager::ScreenManager | ( | EntitySystem & | entities, |
| const Bindings & | bindings, | ||
| SlotEvents & | slots, | ||
| Visibility & | visibility, | ||
| const NetChannels & | clients, | ||
| Connector | connect ) |
The services must outlive this one; connect runs when the first press handler arrives.
Definition at line 16 of file ScreenManager.cpp.
References Pressed.
Referenced by operator=(), and ScreenManager().
|
delete |
References ScreenManager().
| Status VoltMod::ScreenManager::Available | ( | ) | const |
Return the reason screens are unavailable, or success when all required bindings exist.
Definition at line 66 of file ScreenManager.cpp.
References VoltMod::Error::Unsupported().
A screen only slot receives, removed when the slot changes hands. Spawned on its first Screen::EnsureSpawned.
Definition at line 43 of file ScreenManager.cpp.
References VoltMod::Error::Invalid(), VoltMod::IsValidSlot(), and VoltMod::LayoutPath::Parse().
| bool VoltMod::ScreenManager::HasCursor | ( | int | slot | ) | const |
Whether any of slot's screens shows the cursor, so the player's clicks and keys go to it.
Definition at line 60 of file ScreenManager.cpp.
References VoltMod::ScreenEntity::HasCursor(), and VoltMod::ScreenEntity::Owner().
| void VoltMod::ScreenManager::OnPress | ( | int | slot, |
| std::string_view | buttonId ) |
Definition at line 38 of file ScreenManager.cpp.
References Pressed.
|
delete |
References ScreenManager().
| Event<const ButtonPress&> VoltMod::ScreenManager::Pressed |
Every button press from every layout; filter on ButtonPress::ButtonId. A subscription is refused when the client filter table did not bind.
Definition at line 53 of file ScreenManager.hpp.
Referenced by OnPress(), and ScreenManager().