|
ASW Lib
A.D.S. Games SDL Wrapper Library. A library targeted at Allegro4 users who want to switch to SDL3 and use modern c++.
|
Functions | |
| void | _init () |
| Load the file named by ASW_CONFIG, if it is set. Called by asw::core::init() before the window opens. | |
| void | _shutdown () |
| Remove all settings. Called by asw::core::shutdown(). | |
| bool | load (const std::string &path) |
| Load settings from a file. Settings already loaded stay, unless the file sets them again. | |
| bool | has (const std::string &key) |
| Check if a setting is set. | |
| std::optional< std::string > | get_string (const std::string &key) |
| Get a setting as text. | |
| std::optional< bool > | get_bool (const std::string &key) |
| Get a setting as true or false. 1, true, yes and on are true. 0, false, no and off are false. Case does not matter. | |
| std::optional< int > | get_int (const std::string &key) |
| Get a setting as a whole number. | |
| std::optional< float > | get_float (const std::string &key) |
| Get a setting as a number. | |
Variables | |
| constexpr const char * | PATH_VARIABLE = "ASW_CONFIG" |
| Name of the environment variable that holds the config file path. | |
| void asw::config::_init | ( | ) |
Load the file named by ASW_CONFIG, if it is set. Called by asw::core::init() before the window opens.
Definition at line 65 of file config.cpp.
| void asw::config::_shutdown | ( | ) |
Remove all settings. Called by asw::core::shutdown().
Definition at line 75 of file config.cpp.
| std::optional< bool > asw::config::get_bool | ( | const std::string & | key | ) |
Get a setting as true or false. 1, true, yes and on are true. 0, false, no and off are false. Case does not matter.
| key | The setting. |
Definition at line 108 of file config.cpp.
| std::optional< float > asw::config::get_float | ( | const std::string & | key | ) |
Get a setting as a number.
| key | The setting. |
Definition at line 145 of file config.cpp.
| std::optional< int > asw::config::get_int | ( | const std::string & | key | ) |
Get a setting as a whole number.
| key | The setting. |
Definition at line 127 of file config.cpp.
| std::optional< std::string > asw::config::get_string | ( | const std::string & | key | ) |
Get a setting as text.
| key | The setting. |
Definition at line 99 of file config.cpp.
| bool asw::config::has | ( | const std::string & | key | ) |
Check if a setting is set.
| key | The setting, such as "display.fullscreen". |
Definition at line 94 of file config.cpp.
| bool asw::config::load | ( | const std::string & | path | ) |
Load settings from a file. Settings already loaded stay, unless the file sets them again.
Each line is key = value. Blank lines and lines starting with # or ; are ignored. Keys are grouped with dots, such as display.fullscreen.
| path | The file to load. |
Definition at line 80 of file config.cpp.