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 28 of file CenterHtmlMenu.hpp.

Constructor & Destructor Documentation

◆ CenterHtmlMenu()

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

Definition at line 27 of file CenterHtmlMenu.cpp.

Member Function Documentation

◆ Close()

◆ CloseAll() [1/2]

◆ CloseAll() [2/2]

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

◆ IsOpen()

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

Implements VoltMod::MenuSurface.

Definition at line 170 of file CenterHtmlMenu.cpp.

References VoltMod::MenuStack::IsOpen(), and VoltMod::ReadFile().

◆ 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 48 of file CenterHtmlMenu.cpp.

References VoltMod::MenuStack::IsOpen(), VoltMod::IsValidSlot(), OpenSession(), and VoltMod::ReadFile().

◆ 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 33 of file CenterHtmlMenu.cpp.

References CloseAll(), VoltMod::CenterHtmlMenu::Services::Freeze, VoltMod::IsValidSlot(), VoltMod::MenuFreeze::Open(), and VoltMod::ReadFile().

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 159 of file CenterHtmlMenu.cpp.

References VoltMod::ChatInput::BeginCapture(), VoltMod::CenterHtmlMenu::Services::ChatInput, and VoltMod::ReadFile().

◆ 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 165 of file CenterHtmlMenu.cpp.

References VoltMod::Translations::GetOr(), VoltMod::ReadFile(), and VoltMod::CenterHtmlMenu::Services::Translations.


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