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, 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
 

Detailed Description

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.

Member Typedef Documentation

◆ Connector

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

Definition at line 29 of file ScreenManager.hpp.

Constructor & Destructor Documentation

◆ ScreenManager() [1/2]

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

◆ ScreenManager() [2/2]

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

Member Function Documentation

◆ Available()

◆ ForPlayer()

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

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

◆ OnPress()

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

Definition at line 36 of file ScreenManager.cpp.

References Pressed, and VoltMod::ReadFile().

◆ operator=()

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

◆ Shared()

Result< Screen > VoltMod::ScreenManager::Shared ( std::string_view  layout)

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

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 FilterMessage bindings are missing.

Definition at line 52 of file ScreenManager.hpp.

Referenced by OnPress(), and VoltMod::PanoramaMenu::PanoramaMenu().


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