The Allegro Wiki is migrating to github at

Proposed config system

From Allegro Wiki
Jump to: navigation, search

Global string based config with hooks


<highlightSyntax language="c">al_get_config_int(config, "path", "key"); al_set_config_int(config, "path", "key", value);


Driver: <highlightSyntax language="c">al_get_config_int(config, "path", "key") to read settings on initialization al_set_config_hook(config, "path", "key", set_callback, get_callback);


The driver can specify callbacks to respond immediately to setting something, or to query something for the user.

Enum based per-sub-system functions


<highlightSyntax language="c">al_sound_get(driver, AL_ENUM) al_sound_set(driver, AL_ENUM, value)


Settings would get stored into a list in the sound subsystem if driver is NULL.


On initialization, would read from the internal list. Then on set/get, would directly handle it with a switch() based on the enum.