/// <summary> /// Initializes a new instance of the <see cref="T:System.Object"/> class. /// </summary> public MyVideoModeChangeOperation(bool callApplyChanges, bool fullScreen, bool verticalSync, bool hardwareCursor, float fieldOfView, int videoAdapter, MyVideoModeEx videoMode, MyRenderQualityEnum renderQuality, bool first, Action<MyVideoModeChangeOperation> requestCallback) { this.callApplyChanges = callApplyChanges; this.fullScreen = fullScreen; this.verticalSync = verticalSync; this.hardwareCursor = hardwareCursor; this.fieldOfView = fieldOfView; this.videoAdapter = videoAdapter; this.videoMode = videoMode; this.renderQuality = renderQuality; this.first = first; this.requestCallback = requestCallback; }
void OnVideoModeSelected() { MyVideoModeEx mode = MyVideoModeManager.GetVideoModeByIndex(m_videoAdapterCombobox.GetSelectedKey(), m_videoModeCombobox.GetSelectedKey()); m_fieldOfViewSlider.SetValue(MyConstants.FIELD_OF_VIEW_CONFIG_DEFAULT); if (mode.AspectRatio >= (12.0 / 3.0)) { m_fieldOfViewSlider.SetBounds(MyConstants.FIELD_OF_VIEW_CONFIG_MIN, MyConstants.FIELD_OF_VIEW_CONFIG_MAX_TRIPLE_HEAD); } else if (mode.AspectRatio >= (8.0 / 3.0)) { m_fieldOfViewSlider.SetBounds(MyConstants.FIELD_OF_VIEW_CONFIG_MIN, MyConstants.FIELD_OF_VIEW_CONFIG_MAX_DUAL_HEAD); } else { m_fieldOfViewSlider.SetBounds(MyConstants.FIELD_OF_VIEW_CONFIG_MIN, MyConstants.FIELD_OF_VIEW_CONFIG_MAX); } }
/// <summary> /// Begins the change video mode. /// </summary> /// <param name="callApplyChanges">if set to <c>true</c> [call apply changes].</param> /// <param name="videoMode">The video mode.</param> /// <param name="fullScreen">if set to <c>true</c> [full screen].</param> /// <param name="verticalSync">if set to <c>true</c> [vertical sync].</param> /// <param name="hardwareCursor">if set to <c>true</c> [hardware cursor].</param> /// <param name="renderQuality">The render quality.</param> /// <param name="fieldOfView">The field of view.</param> /// <param name="requestCallback">The request callback.</param> /// <param name="state">The state.</param> /// <returns></returns> public static void BeginChangeVideoMode(bool callApplyChanges, int videoAdapter, MyVideoModeEx videoMode, bool fullScreen, bool verticalSync, bool hardwareCursor, MyRenderQualityEnum renderQuality, float fieldOfView, bool first, Action<MyVideoModeChangeOperation> requestCallback) { var result = new MyVideoModeChangeOperation(callApplyChanges, fullScreen, verticalSync, hardwareCursor, fieldOfView, videoAdapter, videoMode, renderQuality, first, requestCallback); m_changeOperations.Enqueue(result); }
static void RegisterVideoMode(int adapterIndex, int width, int height, float ratio) { if ((width > MyMinerGame.GraphicsDeviceManager.MaxTextureSize) || (height > MyMinerGame.GraphicsDeviceManager.MaxTextureSize)) { MyMwcLog.WriteLine("VideoMode " + width.ToString() + " x " + height.ToString() + " requires texture size which is not supported by this HW (this HW supports max " + MyMinerGame.GraphicsDeviceManager.MaxTextureSize.ToString() + ")"); } MyVideoModeEx newVideoMode = null; if (!m_resolutionMap.ContainsKey(adapterIndex)) m_resolutionMap.Add(adapterIndex, new Dictionary<int, Dictionary<int, MyVideoModeEx>>()); if (!m_videoModeList.ContainsKey(adapterIndex)) m_videoModeList.Add(adapterIndex, new List<MyVideoModeEx>()); if (!m_aspectRatioMap.ContainsKey(adapterIndex)) m_aspectRatioMap.Add(adapterIndex, new Dictionary<float, SortedDictionary<int, MyVideoModeEx>>()); if (m_resolutionMap[adapterIndex].ContainsKey(width) == false) { m_resolutionMap[adapterIndex][width] = new Dictionary<int, MyVideoModeEx>(); newVideoMode = new MyVideoModeEx(width, height, ratio); } else if (m_resolutionMap[adapterIndex][width].ContainsKey(height) == false) { newVideoMode = new MyVideoModeEx(width, height, ratio); } if (newVideoMode != null) // So there is a new video mode added, add it to maps and populate related fields { newVideoMode.IsRecommended = newVideoMode.AspectRatioEnum == m_recommendedAspectRatio[adapterIndex].AspectRatioEnum; m_resolutionMap[adapterIndex][width][height] = newVideoMode; m_videoModeList[adapterIndex].Add(newVideoMode); if (m_aspectRatioMap[adapterIndex].ContainsKey(newVideoMode.AspectRatio) == false) { m_aspectRatioMap[adapterIndex][newVideoMode.AspectRatio] = new SortedDictionary<int, MyVideoModeEx>(); m_aspectRatioMap[adapterIndex][newVideoMode.AspectRatio].Add(newVideoMode.Width, newVideoMode); } else if (m_aspectRatioMap[adapterIndex][newVideoMode.AspectRatio].ContainsKey(width) == false) { m_aspectRatioMap[adapterIndex][newVideoMode.AspectRatio].Add(newVideoMode.Width, newVideoMode); } } }