Configuration file access functions. The configuration file is compiled version of the game.project file.
typedef struct Config* HConfig;
Get config value as string, returns default if the key isn't found
config - Config file handle
key - Key in format section.key (.key for no section)
default_value - Default value to return if key isn't found
value - found value or default value
static dmExtension::Result AppInitialize(dmExtension::AppParams* params)
{
const char* projectTitle = dmConfigFile::GetString(params->m_ConfigFile, "project.title", "Untitled");
}
Get config value as int, returns default if the key isn't found Note: default_value is returned for invalid integer values
config - Config file handle
key - Key in format section.key (.key for no section)
default_value - Default value to return if key isn't found
value - found value or default value
static dmExtension::Result AppInitialize(dmExtension::AppParams* params)
{
int32_t displayWidth = dmConfigFile::GetInt(params->m_ConfigFile, "display.width", 640);
}
Get config value as float, returns default if the key isn't found Note: default_value is returned for invalid float values
config - Config file handle
key - Key in format section.key (.key for no section)
default_value - Default value to return if key isn't found
value - found value or default value
static dmExtension::Result AppInitialize(dmExtension::AppParams* params)
{
float gravity = dmConfigFile::GetFloat(params->m_ConfigFile, "physics.gravity_y", -9.8f);
}
Declare and register new config file extension to the engine. Each get function should return true if it sets a proper value. Otherwise return false.
symbol - external extension symbol description (no quotes).
name - extension name. Human readable.
init - init function. May be null.
get_string - Gets a string property. May be null.
get_int - Gets an int property. May be null.
get_float - Gets a float property. May be null.
Register a new config file extension:
DM_DECLARE_CONFIGFILE_EXTENSION(MyConfigfileExtension, "MyConfigfileExtension", create, destroy, get_string, get_int, get_float);