Uint32 JoystickTimerCallback(Uint32 interval, void *) { CApplication *app = CApplication::GetInstancePointer(); if ((app == nullptr) || (! app->GetJoystickEnabled())) return 0; // don't run the timer again app->UpdateJoystick(); return interval; // run for the same interval again }
void CSettings::SaveSettings() { CApplication* app = CApplication::GetInstancePointer(); CRobotMain* main = CRobotMain::GetInstancePointer(); Gfx::CEngine* engine = Gfx::CEngine::GetInstancePointer(); Gfx::CCamera* camera = main->GetCamera(); CSoundInterface* sound = app->GetSound(); GetConfigFile().SetBoolProperty("Setup", "Tooltips", m_tooltips); GetConfigFile().SetBoolProperty("Setup", "InterfaceGlint", m_interfaceGlint); GetConfigFile().SetBoolProperty("Setup", "InterfaceRain", m_interfaceRain); GetConfigFile().SetBoolProperty("Setup", "Soluce4", m_soluce4); GetConfigFile().SetBoolProperty("Setup", "Movies", m_movies); GetConfigFile().SetBoolProperty("Setup", "FocusLostPause", m_focusLostPause); GetConfigFile().SetBoolProperty("Setup", "OldCameraScroll", camera->GetOldCameraScroll()); GetConfigFile().SetBoolProperty("Setup", "CameraInvertX", camera->GetCameraInvertX()); GetConfigFile().SetBoolProperty("Setup", "CameraInvertY", camera->GetCameraInvertY()); GetConfigFile().SetBoolProperty("Setup", "InterfaceEffect", camera->GetEffect()); GetConfigFile().SetBoolProperty("Setup", "Blood", camera->GetBlood()); GetConfigFile().SetBoolProperty("Setup", "Autosave", main->GetAutosave()); GetConfigFile().SetIntProperty("Setup", "AutosaveInterval", main->GetAutosaveInterval()); GetConfigFile().SetIntProperty("Setup", "AutosaveSlots", main->GetAutosaveSlots()); GetConfigFile().SetBoolProperty("Setup", "ObjectDirty", engine->GetDirty()); GetConfigFile().SetBoolProperty("Setup", "FogMode", engine->GetFog()); GetConfigFile().SetBoolProperty("Setup", "LightMode", engine->GetLightMode()); GetConfigFile().SetIntProperty("Setup", "JoystickIndex", app->GetJoystickEnabled() ? app->GetJoystick().index : -1); GetConfigFile().SetFloatProperty("Setup", "ParticleDensity", engine->GetParticleDensity()); GetConfigFile().SetFloatProperty("Setup", "ClippingDistance", engine->GetClippingDistance()); GetConfigFile().SetIntProperty("Setup", "AudioVolume", sound->GetAudioVolume()); GetConfigFile().SetIntProperty("Setup", "MusicVolume", sound->GetMusicVolume()); GetConfigFile().SetBoolProperty("Setup", "EditIndentMode", engine->GetEditIndentMode()); GetConfigFile().SetIntProperty("Setup", "EditIndentValue", engine->GetEditIndentValue()); GetConfigFile().SetIntProperty("Setup", "MipmapLevel", engine->GetTextureMipmapLevel()); GetConfigFile().SetIntProperty("Setup", "Anisotropy", engine->GetTextureAnisotropyLevel()); GetConfigFile().SetFloatProperty("Setup", "ShadowColor", engine->GetShadowColor()); GetConfigFile().SetFloatProperty("Setup", "ShadowRange", engine->GetShadowRange()); GetConfigFile().SetIntProperty("Setup", "MSAA", engine->GetMultiSample()); GetConfigFile().SetIntProperty("Setup", "FilterMode", engine->GetTextureFilterMode()); GetConfigFile().SetBoolProperty("Setup", "ShadowMapping", engine->GetShadowMapping()); GetConfigFile().SetBoolProperty("Setup", "ShadowMappingQuality", engine->GetShadowMappingQuality()); GetConfigFile().SetIntProperty("Setup", "ShadowMappingResolution", engine->GetShadowMappingOffscreen() ? engine->GetShadowMappingOffscreenResolution() : 0); // Experimental settings GetConfigFile().SetBoolProperty("Experimental", "TerrainShadows", engine->GetTerrainShadows()); CInput::GetInstancePointer()->SaveKeyBindings(); GetConfigFile().SetFloatProperty("Edit", "FontSize", m_fontSize); GetConfigFile().SetFloatProperty("Edit", "WindowPosX", m_windowPos.x); GetConfigFile().SetFloatProperty("Edit", "WindowPosY", m_windowPos.y); GetConfigFile().SetFloatProperty("Edit", "WindowDimX", m_windowDim.x); GetConfigFile().SetFloatProperty("Edit", "WindowDimY", m_windowDim.y); GetConfigFile().SetBoolProperty("Edit", "IOPublic", m_IOPublic); GetConfigFile().SetFloatProperty("Edit", "IOPosX", m_IOPos.x); GetConfigFile().SetFloatProperty("Edit", "IOPosY", m_IOPos.y); GetConfigFile().SetFloatProperty("Edit", "IODimX", m_IODim.x); GetConfigFile().SetFloatProperty("Edit", "IODimY", m_IODim.y); std::string lang = ""; LanguageToString(m_language, lang); GetConfigFile().SetStringProperty("Language", "Lang", lang); GetConfigFile().Save(); }