Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RenderCanvasImp"/> class.
        /// </summary>
        public RenderCanvasImp()
        {
            const int width  = 1280;
            var       height = System.Math.Min(Screen.PrimaryScreen.Bounds.Height - 100, 720);

            try
            {
                _gameWindow = new RenderCanvasGameWindow(this, width, height, true);
            }
            catch
            {
                _gameWindow = new RenderCanvasGameWindow(this, width, height, false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RenderCanvasImp"/> class.
        /// </summary>
        /// <param name="width">The width of the render window.</param>
        /// <param name="height">The height of the render window.</param>
        /// <remarks>The window created by this constructor is not visible. Should only be used for internal testing.</remarks>
        public RenderCanvasImp(int width, int height)
        {
            try
            {
                _gameWindow = new RenderCanvasGameWindow(this, width, height, true);
            }
            catch
            {
                _gameWindow = new RenderCanvasGameWindow(this, width, height, false);
            }
            _gameWindow.Visible = false;
            _gameWindow.MakeCurrent();

            _gameWindow.X = 0;
            _gameWindow.Y = 0;
        }
Beispiel #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RenderCanvasImp"/> class.
        /// </summary>
        /// <param name="appIcon">The icon for the render window.</param>
        public RenderCanvasImp(Icon appIcon)
        {
            const int width  = 1280;
            var       height = System.Math.Min(DisplayDevice.Default.Bounds.Height - 100, 720);

            try
            {
                _gameWindow = new RenderCanvasGameWindow(this, width, height, false);
            }
            catch
            {
                _gameWindow = new RenderCanvasGameWindow(this, width, height, false);
            }
            if (appIcon != null)
            {
                _gameWindow.Icon = appIcon;
            }

            _gameWindow.X = (DisplayDevice.Default.Bounds.Width - width) / 2;
            _gameWindow.Y = (DisplayDevice.Default.Bounds.Height - height) / 2;
        }