![]() |
AireEngine
A 3D Open-World Game Engine
|
#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) |
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
| Config::Config | ( | std::string | filepath = "source/utils/config.txt" | ) |
Config constructor. Reads the config from config.txt storing key bindings and global variables.
| filepath | optional filepath argument for multiple config files |
| void Config::addKey | ( | std::string | instruction, |
| std::string | newKey ) |
Add a key binding
| instruction | The new instruction name. |
| newKey | The new key to be bound to instruction. |
Add a variable
| variable | The new variable name. |
| newValue | The new value for the variable. |
| std::string Config::getKey | ( | std::string | instruction | ) |
Get a key binding
| instruction | The instruction needing the key bind. |

| int Config::getKeyCode | ( | std::string | key | ) |
Swaps the string of a stored key into its int value
| instruction | of the key to be decoded |

| float Config::getVar | ( | std::string | variable | ) |
Get a variable
| variable | The variable name that needs the value. |

Save config to file config.txt
| filepath | optional filepath argument for multiple config files |
| void Config::setKey | ( | std::string | instruction, |
| std::string | newKey ) |
Set a key binding
| instruction | The instruction with the new key bind. |
| newKey | The new key to be bound to instruction. |
Set a variable
| variable | The variable name that needs the value. |
| newValue | The new value of the given variable. |