本文整理汇总了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;
}
示例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;
}