/*! \file config.c * \brief Configuration manager code. */ /* * Copyright (c) Sebastian Krzyszkowiak * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include #include "config.h" ALLEGRO_CONFIG *config; void InitConfig() { config = al_load_config_file("SuperDerpy.ini"); if (!config) config=al_create_config(); } void SetConfigOption(char* section, char* name, char* value) { al_set_config_value(config, section, name, value); } const char* GetConfigOption(char* section, char* name) { return al_get_config_value(config, section, name); } const char* GetConfigOptionDefault(char* section, char* name, const char* def) { const char* ret = GetConfigOption(section, name); if (!ret) return def; else return ret; } void DeinitConfig() { al_save_config_file("SuperDerpy.ini", config); al_destroy_config(config); }