void ScriptSettings::Save() const { CSimpleIniA ini; ini.SetUnicode(); ini.LoadFile(SETTINGSFILE); ini.SetValue("OPTIONS", "Enable", EnableManual ? " 1" : " 0"); ini.SetLongValue("OPTIONS", "ShiftMode", ShiftMode); ini.SaveFile(SETTINGSFILE); }
void save(const char* filename) { CSimpleIniA ini; ini.SetUnicode(); ini.SetDoubleValue("Controls", "Mouse Sensitivity", _mouseSensitivity); ini.SetLongValue("Graphics", "Width", _displayWidth); ini.SetLongValue("Graphics", "Height", _displayHeight); ini.SetBoolValue("Graphics", "Fullscreen", _fullscreen); ini.SetBoolValue("Graphics", "Borderless", _borderless); ini.SetDoubleValue("Graphics", "Field of View", _fieldOfView); ini.SetBoolValue("Debug", "Show Console", _showConsole); ini.SetBoolValue("Debug", "Logging", _logging); ini.SetBoolValue("Debug", "Show Mouse Cursor", _showMouseCursor); ini.SetBoolValue("Debug", "Center Mouse Cursor", _centerMouseCursor); ini.SetBoolValue("Debug", "Show FPS", _showFPS); ini.SetBoolValue("Debug", "Show Cursor Coords", _showCursorCoordinates); ini.SetBoolValue("Debug", "Debug Context", _debugContext); ini.SetValue("Debug", "Starting Scene", _startingScene->c_str()); SI_Error rc = ini.SaveFile(filename); if (rc < 0) fputs("Couldn't save settings", stderr); }
bool SettingsManager::saveSettings() { CSimpleIniA ini; ini.SetUnicode(); ini.LoadFile("CONFIG.ini"); if(ini.IsEmpty()) {return false;} ini.SetValue("HIGHSCORE", "NAME", m_settings->HIGHSCORE_NAME.c_str()); ini.SetLongValue("HIGHSCORE", "SCORE", m_settings->HIGHSCORE_SCORE); ini.SetValue("HIGHSCORE2", "NAME", m_settings->HIGHSCORE2_NAME.c_str()); ini.SetLongValue("HIGHSCORE2", "SCORE", m_settings->HIGHSCORE2_SCORE); ini.SetValue("HIGHSCORE3", "NAME", m_settings->HIGHSCORE3_NAME.c_str()); ini.SetLongValue("HIGHSCORE3", "SCORE", m_settings->HIGHSCORE3_SCORE); //Save the file if(ini.SaveFile("CONFIG.ini") < 0) {return false;} return true; }