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

Menus drawn as center HTML and driven with W/S/A/D/E/R. It needs no client addon, so runtime.Menus falls back to it for a player another surface cannot draw for. More...

#include <CenterHtmlMenu.hpp>

Inheritance diagram for VoltMod::CenterHtmlMenu:

Classes

struct  Services

Public Member Functions

 CenterHtmlMenu (const Services &services)
bool OpenSession (int slot, std::shared_ptr< Menu > menu, MenuOptions options) override
void Open (int slot, std::shared_ptr< Menu > menu) override
bool IsOpen (int slot) const override
void Close (int slot) override
void CloseAll (int slot) override
void CloseAll (int slot, std::string_view replyKey) override
void Prompt (int slot, std::string prompt, std::function< bool(int slot, std::string_view text)> callback) override
std::string Translate (int slot, std::string_view key, std::string_view fallback) const override
Public Member Functions inherited from VoltMod::MenuSurface
virtual ~MenuSurface ()=default
 MenuSurface (const MenuSurface &)=delete
MenuSurface & operator= (const MenuSurface &)=delete

Additional Inherited Members

Protected Member Functions inherited from VoltMod::MenuSurface
 MenuSurface ()=default

Detailed Description

Menus drawn as center HTML and driven with W/S/A/D/E/R. It needs no client addon, so runtime.Menus falls back to it for a player another surface cannot draw for.

Definition at line 30 of file CenterHtmlMenu.hpp.

Constructor & Destructor Documentation

◆ CenterHtmlMenu()

VoltMod::CenterHtmlMenu::CenterHtmlMenu ( const Services & services)
explicit

Definition at line 16 of file CenterHtmlMenu.cpp.

Member Function Documentation

◆ Close()

void VoltMod::CenterHtmlMenu::Close ( int slot)
overridevirtual

Pops the top menu, returning to its parent when one exists.

Implements VoltMod::MenuSurface.

Definition at line 72 of file CenterHtmlMenu.cpp.

References VoltMod::IsValidSlot().

◆ CloseAll() [1/2]

void VoltMod::CenterHtmlMenu::CloseAll ( int slot)
overridevirtual

Clears the stack and removes the menu from the player's screen.

Implements VoltMod::MenuSurface.

Definition at line 100 of file CenterHtmlMenu.cpp.

References VoltMod::IsValidSlot().

Referenced by CloseAll(), and OpenSession().

◆ CloseAll() [2/2]

void VoltMod::CenterHtmlMenu::CloseAll ( int slot,
std::string_view replyKey )
overridevirtual

Translates and sends replyKey, then closes every menu.

Implements VoltMod::MenuSurface.

Definition at line 120 of file CenterHtmlMenu.cpp.

References CloseAll().

◆ IsOpen()

bool VoltMod::CenterHtmlMenu::IsOpen ( int slot) const
overridevirtual

Implements VoltMod::MenuSurface.

Definition at line 141 of file CenterHtmlMenu.cpp.

◆ Open()

void VoltMod::CenterHtmlMenu::Open ( int slot,
std::shared_ptr< Menu > menu )
overridevirtual

Pushes menu onto slot's session and shows it, starting one with default options when none is open. What a row calls.

Implements VoltMod::MenuSurface.

Definition at line 37 of file CenterHtmlMenu.cpp.

References VoltMod::IsValidSlot(), and OpenSession().

◆ OpenSession()

bool VoltMod::CenterHtmlMenu::OpenSession ( int slot,
std::shared_ptr< Menu > menu,
MenuOptions options )
overridevirtual

Opens a session for slot showing menu, closing any the player has open here. What a command calls. False when this surface cannot draw for slot; nothing is left open then.

Implements VoltMod::MenuSurface.

Definition at line 22 of file CenterHtmlMenu.cpp.

References CloseAll(), VoltMod::MenuOptions::FreezeMovement, and VoltMod::IsValidSlot().

Referenced by Open().

◆ Prompt()

void VoltMod::CenterHtmlMenu::Prompt ( int slot,
std::string prompt,
std::function< bool(int slot, std::string_view text)> callback )
overridevirtual

Routes the next chat line to callback. Closing the menu cancels it.

Implements VoltMod::MenuSurface.

Definition at line 130 of file CenterHtmlMenu.cpp.

◆ Translate()

std::string VoltMod::CenterHtmlMenu::Translate ( int slot,
std::string_view key,
std::string_view fallback ) const
overridevirtual

Translates key for slot, using fallback when missing.

Implements VoltMod::MenuSurface.

Definition at line 136 of file CenterHtmlMenu.cpp.


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