VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
VoltMod::ScreenManager Class Reference

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

Detailed Description

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.

Member Typedef Documentation

◆ Connector

Subscribes a ScreenManager to the host's button presses; dropping the result unsubscribes.

Definition at line 32 of file ScreenManager.hpp.

Constructor & Destructor Documentation

◆ ScreenManager() [1/2]

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().

◆ ScreenManager() [2/2]

VoltMod::ScreenManager::ScreenManager ( const ScreenManager & )
delete

References ScreenManager().

Member Function Documentation

◆ Available()

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().

◆ Create()

Result< Screen > VoltMod::ScreenManager::Create ( std::string_view layout,
int slot )

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().

◆ HasCursor()

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().

◆ OnPress()

void VoltMod::ScreenManager::OnPress ( int slot,
std::string_view buttonId )

Definition at line 38 of file ScreenManager.cpp.

References Pressed.

◆ operator=()

ScreenManager & VoltMod::ScreenManager::operator= ( const ScreenManager & )
delete

References ScreenManager().

Member Data Documentation

◆ Pressed

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().


The documentation for this class was generated from the following files: