xyginext  0.2.0
Second generation of xygine game creation framework
Public Member Functions | List of all members
xy::ConsoleClient Class Reference

Interface for registering console commands. To register a command with the console a class needs to inherit this interface, which ensures proper lifetime of console commands which refer to specific instances of an object. More...

#include <ConsoleClient.hpp>

Public Member Functions

 ConsoleClient (const ConsoleClient &)=default
 
 ConsoleClient (ConsoleClient &&)=default
 
ConsoleClientoperator= (const ConsoleClient &)=default
 
ConsoleClientoperator= (ConsoleClient &&)=default
 
void registerCommand (const std::string &command, const std::function< void(const std::string &)> &func)
 Registers a command with the console. More...
 

Detailed Description

Interface for registering console commands. To register a command with the console a class needs to inherit this interface, which ensures proper lifetime of console commands which refer to specific instances of an object.

Member Function Documentation

◆ registerCommand()

void xy::ConsoleClient::registerCommand ( const std::string &  command,
const std::function< void(const std::string &)> &  func 
)

Registers a command with the console.

Parameters
commandA string containing the name of the command. Must NOT contain spaces
funcA Console::Command containing the function to execute when the command is received