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

One layout's player screens, each created the first time something draws for that slot. More...

#include <PlayerScreens.hpp>

Public Member Functions

 PlayerScreens (ScreenManager &screens, std::string layout)
Screen & For (int slot)
Screen * Find (int slot)
Screen * FindSpawned (int slot)
Screen * Open (int slot)
void Close (int slot)
bool IsOpen (int slot) const

Detailed Description

One layout's player screens, each created the first time something draws for that slot.

A player screen costs an entity, so this makes one per player who is actually shown the layout rather than one per connected player. A screen removes its entity when its slot changes hands and respawns for the next player on Screen::EnsureSpawned.

Definition at line 20 of file PlayerScreens.hpp.

Constructor & Destructor Documentation

◆ PlayerScreens()

VoltMod::PlayerScreens::PlayerScreens ( ScreenManager & screens,
std::string layout )

screens must outlive this.

Definition at line 19 of file PlayerScreens.cpp.

References VoltMod::RootElement().

Member Function Documentation

◆ Close()

void VoltMod::PlayerScreens::Close ( int slot)

Takes the cursor back and removes the entity: clients draw only their first custom_hud_layout, so a hidden one would block the next.

Definition at line 71 of file PlayerScreens.cpp.

References Find(), VoltMod::Screen::Remove(), and VoltMod::Screen::ShowCursor().

◆ Find()

Screen * VoltMod::PlayerScreens::Find ( int slot)

slot's screen if one was created, or null. Never creates.

Definition at line 44 of file PlayerScreens.cpp.

References VoltMod::IsValidSlot().

Referenced by Close().

◆ FindSpawned()

Screen * VoltMod::PlayerScreens::FindSpawned ( int slot)

slot's screen created and spawned, ready to draw; null for a bot, an empty slot, or a screen that cannot spawn.

Definition at line 53 of file PlayerScreens.cpp.

References VoltMod::Screen::EnsureSpawned(), and For().

Referenced by Open().

◆ For()

Screen & VoltMod::PlayerScreens::For ( int slot)

slot's screen, created on first use. One ScreenManager::Create refuses is logged once and stays empty, so its writes fail quietly.

Definition at line 23 of file PlayerScreens.cpp.

References VoltMod::IsValidSlot(), and VoltMod::Log::Warn().

Referenced by FindSpawned().

◆ IsOpen()

bool VoltMod::PlayerScreens::IsOpen ( int slot) const

Whether slot's screen is open: after Open, until Close, the slot changing hands or a map change removing the entity.

Definition at line 82 of file PlayerScreens.cpp.

References VoltMod::IsValidSlot().

◆ Open()

Screen * VoltMod::PlayerScreens::Open ( int slot)

FindSpawned, then shows the layout's root element and gives the player a cursor, so it takes their clicks until Close. Null when it cannot spawn.

Definition at line 59 of file PlayerScreens.cpp.

References FindSpawned(), VoltMod::Screen::SetHidden(), and VoltMod::Screen::ShowCursor().


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