예제 #1
0
 public MyRenderDeviceSettings(int adapter, MyWindowModeEnum windowMode, int width, int height, int refreshRate, bool vsync)
 {
     this.AdapterOrdinal   = adapter;
     this.WindowMode       = windowMode;
     this.BackBufferWidth  = width;
     this.BackBufferHeight = height;
     this.RefreshRate      = refreshRate;
     this.VSync            = vsync;
 }
예제 #2
0
        public MyRenderDeviceSettings(int adapter)
        {
            this.AdapterOrdinal   = adapter;
            this.WindowMode       = MyWindowModeEnum.Window;
            this.BackBufferWidth  = 0;
            this.BackBufferHeight = 0;
            this.RefreshRate      = 0;
            this.VSync            = true;

            DebugDrawOnly = false;
        }
예제 #3
0
        public MyRenderDeviceSettings(int adapter, MyWindowModeEnum windowMode, int width, int height, int refreshRate, bool vsync, bool useStereoRendering, bool settingsMandatory)
        {
            this.AdapterOrdinal     = adapter;
            this.WindowMode         = windowMode;
            this.BackBufferWidth    = width;
            this.BackBufferHeight   = height;
            this.RefreshRate        = refreshRate;
            this.VSync              = vsync;
            this.UseStereoRendering = useStereoRendering;
            this.SettingsMandatory  = settingsMandatory;

            DebugDrawOnly = false;
        }
예제 #4
0
        public void UpdateSize(MyWindowModeEnum ? customMode = null)
        {
            ProfilerShort.Begin("UpdateSize");

            switch (customMode.HasValue ? customMode.Value : m_settings.WindowMode)
            {
                case MyWindowModeEnum.Fullscreen:
                    m_renderWindow.OnModeChanged(MyWindowModeEnum.Fullscreen, m_settings.BackBufferWidth, m_settings.BackBufferHeight);
                    break;

                case MyWindowModeEnum.FullscreenWindow:
                    {
                        WinApi.DEVMODE mode = new WinApi.DEVMODE();
                        WinApi.EnumDisplaySettings(null, WinApi.ENUM_REGISTRY_SETTINGS, ref mode);
                        VRage.Trace.MyTrace.Watch("Registry display settings", string.Format("{0}x{1}", mode.dmPelsWidth, mode.dmPelsHeight));
                        m_renderWindow.OnModeChanged(MyWindowModeEnum.FullscreenWindow, mode.dmPelsWidth, mode.dmPelsHeight);
                        break;
                    }

                case MyWindowModeEnum.Window:
                    m_renderWindow.OnModeChanged(MyWindowModeEnum.Window, m_settings.BackBufferWidth, m_settings.BackBufferHeight);
                    break;
            }

            var handler = SizeChanged;
            if (handler != null) handler(MyRenderProxy.BackBufferResolution.X, MyRenderProxy.BackBufferResolution.Y, MyRenderProxy.MainViewport);

            ProfilerShort.End();
        }
예제 #5
0
        private static bool IsSupportedDisplayMode(int videoAdapter, int width, int height, MyWindowModeEnum windowMode)
        {
            bool result = false;

            if (windowMode == MyWindowModeEnum.Fullscreen)
            {
                foreach (var mode in m_adapters[videoAdapter].SupportedDisplayModes)
                {
                    if (mode.Width == width && mode.Height == height)
                    {
                        result = true;
                    }
                }
            }
            else
            {
                result = true;
            }

            int maxTextureSize = m_adapters[MySandboxGame.Config.VideoAdapter].MaxTextureSize;

            if (width > maxTextureSize || height > maxTextureSize)
            {
                MySandboxGame.Log.WriteLine(
                    string.Format("VideoMode {0}x{1} requires texture size which is not supported by this HW (this HW supports max {2})",
                                  width, height, maxTextureSize));
                result = false;
            }
            return(result);
        }
예제 #6
0
        private static bool IsSupportedDisplayMode(int videoAdapter, int width, int height, MyWindowModeEnum windowMode)
        {
            bool flag = false;

            if (windowMode != MyWindowModeEnum.Fullscreen)
            {
                flag = true;
            }
            else
            {
                foreach (MyDisplayMode mode in m_adapters[videoAdapter].SupportedDisplayModes)
                {
                    if ((mode.Width == width) && (mode.Height == height))
                    {
                        flag = true;
                    }
                }
            }
            int maxTextureSize = m_adapters[videoAdapter].MaxTextureSize;

            if ((width > maxTextureSize) || (height > maxTextureSize))
            {
                MySandboxGame.Log.WriteLine($"VideoMode {width}x{height} requires texture size which is not supported by this HW (this HW supports max {maxTextureSize})");
                flag = false;
            }
            return(flag);
        }