AireEngine
A 3D Open-World Game Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Aire::Config Class Reference

#include <config.h>

Public Member Functions

 Config (std::string filepath="source/utils/config.txt")
 
void saveConfig (std::string filepath="source/utils/config.txt")
 
std::string getKey (std::string instruction)
 
void setKey (std::string instruction, std::string newKey)
 
void addKey (std::string instruction, std::string newKey)
 
float getVar (std::string variable)
 
void setVar (std::string variable, float newValue)
 
void addVar (std::string variable, float newValue)
 
int getKeyCode (std::string key)
 

Detailed Description

A custom config class that allows reading and editing of global settings and variables. Keybindings should always be written in all upper case, Instructions should always be written in all lower case

Constructor & Destructor Documentation

◆ Config()

Config::Config ( std::string filepath = "source/utils/config.txt")

Config constructor. Reads the config from config.txt storing key bindings and global variables.

Parameters
filepathoptional filepath argument for multiple config files

Member Function Documentation

◆ addKey()

void Config::addKey ( std::string instruction,
std::string newKey )

Add a key binding

Parameters
instructionThe new instruction name.
newKeyThe new key to be bound to instruction.
Returns
Nothing

◆ addVar()

void Config::addVar ( std::string variable,
float newValue )

Add a variable

Parameters
variableThe new variable name.
newValueThe new value for the variable.
Returns
Nothing

◆ getKey()

std::string Config::getKey ( std::string instruction)

Get a key binding

Parameters
instructionThe instruction needing the key bind.
Returns
Returns the key binding for the given instruction.
Here is the caller graph for this function:

◆ getKeyCode()

int Config::getKeyCode ( std::string key)

Swaps the string of a stored key into its int value

Parameters
instructionof the key to be decoded
Returns
Integer code of the key given the string
Here is the call graph for this function:

◆ getVar()

float Config::getVar ( std::string variable)

Get a variable

Parameters
variableThe variable name that needs the value.
Returns
Returns the value of the given variable name.
Here is the caller graph for this function:

◆ saveConfig()

void Config::saveConfig ( std::string filepath = "source/utils/config.txt")

Save config to file config.txt

Parameters
filepathoptional filepath argument for multiple config files
Returns
Nothing

◆ setKey()

void Config::setKey ( std::string instruction,
std::string newKey )

Set a key binding

Parameters
instructionThe instruction with the new key bind.
newKeyThe new key to be bound to instruction.
Returns
Nothing

◆ setVar()

void Config::setVar ( std::string variable,
float newValue )

Set a variable

Parameters
variableThe variable name that needs the value.
newValueThe new value of the given variable.
Returns
Nothing

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