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++.
Loading...
Searching...
No Matches
config.h File Reference

Settings from a config file, set by whoever runs the game. More...

#include <optional>
#include <string>
Include dependency graph for config.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  asw
 
namespace  asw::config
 

Functions

void asw::config::_init ()
 Load the file named by ASW_CONFIG, if it is set. Called by asw::core::init() before the window opens.
 
void asw::config::_shutdown ()
 Remove all settings. Called by asw::core::shutdown().
 
bool asw::config::load (const std::string &path)
 Load settings from a file. Settings already loaded stay, unless the file sets them again.
 
bool asw::config::has (const std::string &key)
 Check if a setting is set.
 
std::optional< std::string > asw::config::get_string (const std::string &key)
 Get a setting as text.
 
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.
 
std::optional< int > asw::config::get_int (const std::string &key)
 Get a setting as a whole number.
 
std::optional< float > asw::config::get_float (const std::string &key)
 Get a setting as a number.
 

Variables

constexpr const char * asw::config::PATH_VARIABLE = "ASW_CONFIG"
 Name of the environment variable that holds the config file path.
 

Detailed Description

Settings from a config file, set by whoever runs the game.

Author
Allan Legemaate (alege.nosp@m.maat.nosp@m.e@gma.nosp@m.il.c.nosp@m.om)
Date
2026-09-30

Definition in file config.h.