Roguelike
 All Classes Namespaces Functions Variables Typedefs Friends Pages
Public Member Functions | Private Attributes | List of all members
DebugConsole Class Reference

Public Member Functions

 DebugConsole ()
 
 DebugConsole (Game *_game)
 
void run_command (std::string input)
 
std::string get_message ()
 
std::string input_from_buffer (int direction)
 
void help (std::vector< std::string > command, std::vector< int > args)
 
void list (std::vector< std::string > command, std::vector< int > args)
 
void killall (std::vector< std::string > command, std::vector< int > args)
 
void spawn (std::vector< std::string > command, std::vector< int > args)
 
void teleport (std::vector< std::string > command, std::vector< int > args)
 

Private Attributes

std::vector< std::string > buffer
 
int buffer_place
 
int current_place
 
int buffer_size
 
std::string debug_message
 
Gamegame
 
std::map< std::string, function > func_map
 

Constructor & Destructor Documentation

DebugConsole::DebugConsole ( )

Empty constructor.

DebugConsole::DebugConsole ( Game _game)

Constructor for DebugConsole.

Parameters
_gameSets the game member object to _game.

Member Function Documentation

std::string DebugConsole::get_message ( )

Accessor for the member variable debug_message.

Returns
Member variable debug_message.
void DebugConsole::help ( std::vector< std::string >  command,
std::vector< int >  args 
)

Brings up the help menu.

Parameters
commandThe list of string arguments for the function.
argsThe list of int arguments for the function.
std::string DebugConsole::input_from_buffer ( int  direction)

Returns somewhere in the buffer. Takes in a number, and changes current_place by that value.

Parameters
directionThe direction to move in the buffer.
Returns
The string at that location in the buffer.
void DebugConsole::killall ( std::vector< std::string >  command,
std::vector< int >  args 
)

Kills everything in game.enemy_list.

Parameters
commandThe list of string arguments for the function.
argsThe list of int arguments for the function.
void DebugConsole::list ( std::vector< std::string >  command,
std::vector< int >  args 
)

Lists something (i.e. your coordinates).

Parameters
commandThe list of string arguments for the function.
argsThe list of int arguments for the function.
void DebugConsole::run_command ( std::string  input)

Runs a command based on input. Takes in a string, processes it, and runs the command. The string includes the space separated arguments.

Parameters
commandThe command to run.
void DebugConsole::spawn ( std::vector< std::string >  command,
std::vector< int >  args 
)

Spawns enemies.

Parameters
commandThe list of string arguments for the function.
argsThe list of int arguments for the function.
void DebugConsole::teleport ( std::vector< std::string >  command,
std::vector< int >  args 
)

Teleports the main character.

Parameters
commandThe list of string arguments for the function.
argsThe list of int arguments for the function.

Member Data Documentation

std::vector<std::string> DebugConsole::buffer
private

A buffer to hold the previous commands which have been input.

int DebugConsole::buffer_place
private

An index of where the most recent command is in the buffer.

int DebugConsole::buffer_size
private

The maximum size of the buffer.

int DebugConsole::current_place
private

The current place that we are in the buffer.

std::string DebugConsole::debug_message
private

The message to show the player.

std::map<std::string, function> DebugConsole::func_map
private

A hashmap to make the functions directly callable. This allows the functions to be called directly by name instead of needing to use an if else or switch case.

Game* DebugConsole::game
private

An instance of the game so the console can do things.


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