|
VoltMod
C++23 framework for CS2 server plugins
|
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 |
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.
| VoltMod::PlayerScreens::PlayerScreens | ( | ScreenManager & | screens, |
| std::string | layout ) |
screens must outlive this.
Definition at line 19 of file PlayerScreens.cpp.
References VoltMod::RootElement().
| 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().
| 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().
| 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().
| 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().
| 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().
| 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().