VoltMod
C++23 framework for CS2 server plugins
Loading...
Searching...
No Matches
PlayerScreens.hpp
Go to the documentation of this file.
1#pragma once
2
6#include <optional>
7#include <string>
8
9namespace VoltMod
10{
11
12/**
13 * @brief One layout's player screens, each created the first time something draws for that slot.
14 *
15 * A player screen costs an entity, so this makes one per player who is actually shown the layout
16 * rather than one per connected player. A screen removes its entity when its slot changes hands
17 * and respawns for the next player on @ref Screen::EnsureSpawned.
18 */
20{
21public:
22 /** @p screens must outlive this. */
24
25 /** @p slot's screen, created on first use. One @ref ScreenManager::ForPlayer refuses is logged
26 * once and stays empty, so its writes fail quietly. */
27 Screen& For(int slot);
28
29 /** @p slot's screen if one was created, or null. Never creates. */
30 Screen* Find(int slot);
31
32private:
33 ScreenManager& _screens;
34 std::string _layout;
36 /** Handed out for a slot that is not a player slot. */
37 Screen _empty;
38};
39
40} // namespace VoltMod
Per-player-slot value store that never leaks state across occupants.
Definition PerSlot.hpp:25
One layout's player screens, each created the first time something draws for that slot.
Screen & For(int slot)
Screen * Find(int slot)
Create Screen objects and report their button presses.
A spawned Panorama layout created by ScreenManager.
Definition Screen.hpp:23
static std::string ReadFile(const std::filesystem::path &path)
Definition Loader.cpp:56