Beispiel #1
0
        //------------------------------------------------------------------------------------------------------------------------
        //                                                        Game()
        //------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Initializes a new instance of the <see cref="Game"/> class.
        /// This class represents a game window, containing an openGL view.
        /// </summary>
        /// <param name='width'>
        /// Width of the window in pixels.
        /// </param>
        /// <param name='height'>
        /// Height of the window in pixels.
        /// </param>
        /// <param name='fullScreen'>
        /// If set to <c>true</c> the application will run in fullscreen mode.
        /// </param>
        public Game(int pWidth, int pHeight, bool pFullScreen, bool pVSync = true)
            : base()
        {
            if (main != null) {
                throw new Exception ("Only a single instance of Game is allowed");
            } else {

                main = this;
                _updateManager = new UpdateManager ();
                _collisionManager = new CollisionManager ();
                _glContext = new GLContext (this);
                _glContext.CreateWindow (pWidth, pHeight, pFullScreen, pVSync);
                _gameObjectsContained = new List<GameObject>();

                //register ourselves for updates
                Add (this);

            }
        }