src/config.c
Config configInit(const char *filename)
{
    static Config config;

    config.video.fps        =  60;
    config.video.fullscreen =   0;
    config.video.height     = 600;
    config.video.limitFPS   =   1;
    config.video.width      = 800;

    if (0 > ini_parse(filename, handler, &config))
    {
        fprintf(stderr, "Couldn't load configuration file: %s\n", filename);
    }

    if (0 > config.video.fps)    config.video.fps    = abs(config.video.fps);
    if (0 > config.video.height) config.video.height = abs(config.video.height);
    if (0 > config.video.width)  config.video.width  = abs(config.video.width);

    return config;
}
/**
 * @brief   Initialise configuration file.
 * @param   filename the configuration file to load.
 * @return  Always Config, error message on failure.  It is important to define
 *          a fallback in the main program.  See @ref struct Config.
 * @ingroup Config
 */
@brief   Initialise configuration file.
@param   filename the configuration file to load.
@return  Always Config, error message on failure.  It is important to define
a fallback in the main program.  See @ref struct Config.
@ingroup Config
@brief Initialise configuration file . @param filename the configuration file to load . @return Always Config error message on failure . It is important to define a fallback in the main program . See @ref struct Config . @ingroup Config
Config configInit(const char *filename)
{
    static Config config;
    config.video.fps        =  60;
    config.video.fullscreen =   0;
    config.video.height     = 600;
    config.video.limitFPS   =   1;
    config.video.width      = 800;
    if (0 > ini_parse(filename, handler, &config))
    {
        fprintf(stderr, "Couldn't load configuration file: %s\n", filename);
    }
    if (0 > config.video.fps)    config.video.fps    = abs(config.video.fps);
    if (0 > config.video.height) config.video.height = abs(config.video.height);
    if (0 > config.video.width)  config.video.width  = abs(config.video.width);
    return config;
}
Config configInit ( const char * filename ) { static Config config ; config . video . fps = 60 ; config . video . fullscreen = 0 ; config . video . height = 600 ; config . video . limitFPS = 1 ; config . video . width = 800 ; if ( 0 > ini_parse ( filename , handler , & config ) ) { fprintf ( stderr , " \n " , filename ) ; } if ( 0 > config . video . fps ) config . video . fps = abs ( config . video . fps ) ; if ( 0 > config . video . height ) config . video . height = abs ( config . video . height ) ; if ( 0 > config . video . width ) config . video . width = abs ( config . video . width ) ; return config ; }
@brief   Initialise configuration file.
@brief Initialise configuration file .