These functions are declared in the main Allegro header file:
#include <allegro5/allegro.h>
al_install_system
bool al_install_system(int version, int (*atexit_ptr)(void (*)(void)))
Initialize the Allegro system. No other Allegro functions can be called before this (with one or two exceptions).
The version field should always be set to ALLEGRO_VERSION_INT.
If atexit_ptr is non-NULL, and if hasn't been done already, al_uninstall_system will be registered as an atexit function.
Returns true if Allegro was successfully initialized by this function call (or already was initialized previously), false if Allegro cannot be used.
See also: al_init
al_init
#define al_init() (al_install_system(ALLEGRO_VERSION_INT, atexit))
Like al_install_system, but automatically passes in the version and uses the atexit function visible in the current compilation unit.
See also: al_install_system
al_uninstall_system
void al_uninstall_system(void)
Closes down the Allegro system.
Note: al_uninstall_system() can be called without a corresponding al_install_system call, e.g. from atexit().
al_get_allegro_version
uint32_t al_get_allegro_version(void)
Returns the (compiled) version of the Allegro library, packed into a single integer as groups of 8 bits in the form (major << 24) | (minor << 16) | (revision << 8) | release
.
You can use code like this to extract them:
uint32_t version = al_get_allegro_version();
int major = version >> 24;
int minor = (version >> 16) & 255;
int revision = (version >> 8) & 255;
int release = version & 255;
The release
number is 0 for an unofficial version and 1 or greater for an official release. For example "5.0.2[1]" would be the (first) official 5.0.2 release while "5.0.2[0]" would be a compile of a version from the "5.0.2" branch before the official release.
al_get_standard_path
ALLEGRO_PATH *al_get_standard_path(int id)
Gets a system path, depending on the id
parameter:
id | description |
---|---|
ALLEGRO_PROGRAM_PATH | Directory with the executed program. |
ALLEGRO_TEMP_PATH | Path to the directory for temporary files. |
ALLEGRO_SYSTEM_DATA_PATH | Data path for system-wide installation. |
ALLEGRO_USER_DATA_PATH | Data path for per-user installation. |
ALLEGRO_USER_HOME_PATH | Path to the user's home directory. |
ALLEGRO_USER_SETTINGS_PATH | Path to per-user settings directory. |
ALLEGRO_SYSTEM_SETTINGS_PATH | Path to system-wide settings directory. |
ALLEGRO_EXENAME_PATH | The full path to the executable. |
Returns NULL on failure. The returned path should be freed with al_destroy_path.
See also: al_set_app_name, al_set_org_name, al_destroy_path
al_set_app_name
void al_set_app_name(const char *app_name)
Sets the global application name.
The application name is used by al_get_standard_path to build the full path to an application's files.
This function may be called before al_init or al_install_system.
See also: al_get_app_name, al_set_org_name
al_set_org_name
void al_set_org_name(const char *org_name)
Sets the global organization name.
The organization name is used by al_get_standard_path to build the full path to an application's files.
This function may be called before al_init or al_install_system.
See also: al_get_org_name, al_set_app_name
al_get_app_name
const char *al_get_app_name(void)
Returns the global application name string.
See also: al_set_app_name
al_get_org_name
const char *al_get_org_name(void)
Returns the global organization name string.
See also: al_set_org_name
al_get_system_driver
ALLEGRO_SYSTEM *al_get_system_driver(void)
Returns the currently active system driver, or NULL.
al_get_system_config
ALLEGRO_CONFIG *al_get_system_config(void)
Returns the configuration for the installed system, if any, or NULL otherwise. This is mainly used for configuring Allegro and its addons.