Microsoft.Xna.Framework.OpenTKGameWindow.Initialize C# (CSharp) Method

Initialize() private method

private Initialize ( Microsoft.Xna.Framework.Game game ) : void
game Microsoft.Xna.Framework.Game
return void
        private void Initialize(Game game)
        {
            Game = game;

            GraphicsContext.ShareContexts = true;

            window = new NativeWindow();
            window.WindowBorder = WindowBorder.Resizable;
            window.Closing += new EventHandler<CancelEventArgs>(OpenTkGameWindow_Closing);
            window.Resize += OnResize;
            window.KeyDown += new EventHandler<OpenTK.Input.KeyboardKeyEventArgs>(Keyboard_KeyDown);
            window.KeyUp += new EventHandler<OpenTK.Input.KeyboardKeyEventArgs>(Keyboard_KeyUp);

            window.KeyPress += OnKeyPress;

            //make sure that the game is not running on linux
            //on Linux people may want to use mkbundle to
            //create native Linux binaries
            if (CurrentPlatform.OS != OS.Linux)
            {
                // Set the window icon.
                var assembly = Assembly.GetEntryAssembly();
                if (assembly != null)
                    window.Icon = Icon.ExtractAssociatedIcon(assembly.Location);
                Title = MonoGame.Utilities.AssemblyHelper.GetDefaultWindowTitle();
            }

            updateClientBounds = false;
            clientBounds = new Rectangle(window.ClientRectangle.X, window.ClientRectangle.Y,
                                         window.ClientRectangle.Width, window.ClientRectangle.Height);
            windowState = window.WindowState;            

            _windowHandle = window.WindowInfo.Handle;

            keys = new List<Keys>();

            // mouse
            // TODO review this when opentk 1.1 is released
#if DESKTOPGL || ANGLE
            Mouse.setWindows(this);
#else
            Mouse.UpdateMouseInfo(window.Mouse);
#endif

            // Default no resizing
            AllowUserResizing = false;

            // Default mouse cursor hidden 
            SetMouseVisible(false);
        }