当前位置: 首页>>代码示例>>C#>>正文


C# MyRenderDeviceSettings.Equals方法代码示例

本文整理汇总了C#中MyRenderDeviceSettings.Equals方法的典型用法代码示例。如果您正苦于以下问题:C# MyRenderDeviceSettings.Equals方法的具体用法?C# MyRenderDeviceSettings.Equals怎么用?C# MyRenderDeviceSettings.Equals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MyRenderDeviceSettings的用法示例。


在下文中一共展示了MyRenderDeviceSettings.Equals方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadSettingsFromControls

        private bool ReadSettingsFromControls(ref MyRenderDeviceSettings deviceSettings)
        {
            bool changed;
            MyRenderDeviceSettings read = new MyRenderDeviceSettings();

            var selectedResolution = (int)m_comboResolution.GetSelectedKey();
            if ((uint)selectedResolution < (uint)m_resolutions.Count)
            {
                var resolution = m_resolutions[selectedResolution];
                read.BackBufferWidth = resolution.X;
                read.BackBufferHeight = resolution.Y;
                read.WindowMode = (MyWindowModeEnum)m_comboWindowMode.GetSelectedKey();
                read.AdapterOrdinal = (int)m_comboVideoAdapter.GetSelectedKey();
                read.VSync = m_checkboxVSync.IsChecked;
                read.RefreshRate = 0;
                foreach (var displayMode in MyVideoSettingsManager.Adapters[deviceSettings.AdapterOrdinal].SupportedDisplayModes)
                { // Pick the highest refresh rate available (although it might be better to add combobox for refresh rates as well)
                    if (displayMode.Width == read.BackBufferWidth &&
                        displayMode.Height == read.BackBufferHeight &&
                        read.RefreshRate < displayMode.RefreshRate)
                    {
                        read.RefreshRate = displayMode.RefreshRate;
                    }
                }
                changed = !read.Equals(ref deviceSettings);
                deviceSettings = read;
            }
            else
            { // unsupported display mode selected, so pretend nothing was changed
                changed = false;
            }

            return changed;
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:34,代码来源:MyGuiScreenOptionsDisplay.cs

示例2: ReadSettingsFromControls

        private bool ReadSettingsFromControls(ref MyRenderDeviceSettings deviceSettings)
        {
            bool changed = false;
            MyRenderDeviceSettings read = new MyRenderDeviceSettings
                {
                    AdapterOrdinal = deviceSettings.AdapterOrdinal, // We don't change the value until restarting the game (NewAdapter is loaded from Config)
                };

            var selectedResolution = (int)m_comboResolution.GetSelectedKey();
            if ((uint)selectedResolution < (uint)m_resolutions.Count)
            {
                var resolution = m_resolutions[selectedResolution];
                read.BackBufferWidth = resolution.X;
                read.BackBufferHeight = resolution.Y;
                read.WindowMode = (MyWindowModeEnum)m_comboWindowMode.GetSelectedKey();

                read.NewAdapterOrdinal = (int)m_comboVideoAdapter.GetSelectedKey(); // Setting NewAdapter instead of Adapter -- it is saved to config on game end
                changed |= read.NewAdapterOrdinal != read.AdapterOrdinal; // Notify change of adapter (it is not included in Settings' Equals)

                read.VSync = m_checkboxVSync.IsChecked;
                read.RefreshRate = 0;

                if (m_checkboxCaptureMouse.IsChecked != MySandboxGame.Config.CaptureMouse)
                {
                    MySandboxGame.Config.CaptureMouse = m_checkboxCaptureMouse.IsChecked;
                    MySandboxGame.Static.UpdateMouseCapture();
                }

                foreach (var displayMode in MyVideoSettingsManager.Adapters[deviceSettings.AdapterOrdinal].SupportedDisplayModes)
                { // Pick the highest refresh rate available (although it might be better to add combobox for refresh rates as well)
                    if (displayMode.Width == read.BackBufferWidth &&
                        displayMode.Height == read.BackBufferHeight &&
                        read.RefreshRate < displayMode.RefreshRate)
                    {
                        read.RefreshRate = displayMode.RefreshRate;
                    }
                }
                changed = changed || !read.Equals(ref deviceSettings);
                deviceSettings = read;
            }

            return changed;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:43,代码来源:MyGuiScreenOptionsDisplay.cs


注:本文中的MyRenderDeviceSettings.Equals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。