private bool ApplyGraphicOptions(RAGLINKCommons.RPlatform.GraphicOptionsManager.GraphicOptionsValue optionsData) { bool retValue = false; try { Interface.CurrentOptions.FullscreenMode = optionsData.enableFullScreen; if (optionsData.enableFullScreen) { Interface.CurrentOptions.FullscreenHeight = optionsData.simulatorHeight; Interface.CurrentOptions.FullscreenWidth = optionsData.simulatorWidth; } else { Interface.CurrentOptions.WindowHeight = optionsData.simulatorHeight; Interface.CurrentOptions.WindowWidth = optionsData.simulatorWidth; } Interface.CurrentOptions.VerticalSynchronization = optionsData.enableVSync; Interface.CurrentOptions.MotionBlur = optionsData.enableMotionBlur ? Interface.MotionBlurMode.High : Interface.MotionBlurMode.None; Interface.CurrentOptions.ViewingDistance = optionsData.viewingDistance; switch (optionsData.transparencyLevel) { case 1: { Interface.CurrentOptions.TransparencyMode = OpenBveApi.Graphics.TransparencyMode.Quality; break; } case 2: { Interface.CurrentOptions.TransparencyMode = OpenBveApi.Graphics.TransparencyMode.Intermediate; break; } case 3: { Interface.CurrentOptions.TransparencyMode = OpenBveApi.Graphics.TransparencyMode.Performance; break; } } Interface.CurrentOptions.AntiAliasingLevel = optionsData.antiAliasingLevel; retValue = true; } catch (Exception) { }; return(retValue); }
private void LoadOptionsOnForm() { optionsValueLoaded = RAGLINKCommons.RPlatform.GraphicOptionsManager.graphicOptionsValue; optionsValueCurrent = (RAGLINKCommons.RPlatform.GraphicOptionsManager.GraphicOptionsValue)optionsValueLoaded.Clone(); checkBoxFullScreen.Checked = optionsValueLoaded.enableFullScreen; checkBoxWindowsState.Checked = !optionsValueLoaded.enableFullScreen; checkBoxMotionBlur.Checked = optionsValueLoaded.enableMotionBlur; checkBoxVSync.Checked = optionsValueLoaded.enableVSync; textBoxWidth.Text = optionsValueLoaded.simulatorWidth.ToString(); textBoxHeight.Text = optionsValueLoaded.simulatorHeight.ToString(); textBoxViewingDis.Text = optionsValueLoaded.viewingDistance.ToString(); switch (optionsValueLoaded.antiAliasingLevel) { case 1: { buttonAntiLevel1.BackColor = System.Drawing.Color.FromArgb(128, 255, 128); buttonAntiLevel2.BackColor = System.Drawing.Color.White; buttonAntiLevel3.BackColor = System.Drawing.Color.White; buttonAntiLevel4.BackColor = System.Drawing.Color.White; break; } case 2: { buttonAntiLevel1.BackColor = System.Drawing.Color.White; buttonAntiLevel2.BackColor = System.Drawing.Color.FromArgb(128, 255, 128); buttonAntiLevel3.BackColor = System.Drawing.Color.White; buttonAntiLevel4.BackColor = System.Drawing.Color.White; break; } case 3: { buttonAntiLevel1.BackColor = System.Drawing.Color.White; buttonAntiLevel2.BackColor = System.Drawing.Color.White; buttonAntiLevel3.BackColor = System.Drawing.Color.FromArgb(128, 255, 128); buttonAntiLevel4.BackColor = System.Drawing.Color.White; break; } case 4: { buttonAntiLevel1.BackColor = System.Drawing.Color.White; buttonAntiLevel2.BackColor = System.Drawing.Color.White; buttonAntiLevel3.BackColor = System.Drawing.Color.White; buttonAntiLevel4.BackColor = System.Drawing.Color.FromArgb(128, 255, 128); break; } } switch (optionsValueLoaded.transparencyLevel) { case 1: { buttonTransLevel1.BackColor = System.Drawing.Color.FromArgb(128, 255, 128); buttonTransLevel2.BackColor = System.Drawing.Color.White; buttonTransLevel3.BackColor = System.Drawing.Color.White; break; } case 2: { buttonTransLevel1.BackColor = System.Drawing.Color.White; buttonTransLevel2.BackColor = System.Drawing.Color.FromArgb(128, 255, 128); buttonTransLevel3.BackColor = System.Drawing.Color.White; break; } case 3: { buttonTransLevel1.BackColor = System.Drawing.Color.White; buttonTransLevel2.BackColor = System.Drawing.Color.White; buttonTransLevel3.BackColor = System.Drawing.Color.FromArgb(128, 255, 128); break; } } ApplyGraphicOptions(optionsValueLoaded); buttonSaveOptions.Enabled = false; }