示例#1
0
        public GameEngine()
        {
            #region GameWindow properties and init
            GameWindow.FormBorderStyle = FormBorderStyle.Fixed3D;
            GameWindow.ClientSize = new Size(Width, Height);
            GameWindow.Text = Title;
            GameWindow.MaximizeBox = false;
            GameWindow.StartPosition = FormStartPosition.CenterScreen;
            GameWindow.KeyPreview = false;

            //Add the GameScreen to the GameWindow
            GameWindow.Controls.Add(GameScreen);

            //Pull out the Draw event in the gamescreen
            GameScreen.Paint += GameDraw;

            //Pull out the FormClosed event so we can terminate the game thread
            GameWindow.FormClosed += GameWindow_FormClosed;
            #endregion

            //Other game objects
            GameTimer = new HiResTimer();
            GameInput = new Input(GameWindow, GameScreen);

            //Create the game
            game = new Game(this);

            //Start the game thread
            StartGameThread();

            //Start the form application
            Application.Run(GameWindow);
        }
示例#2
0
		public Controls(Game game)
		{
			this.game = game;
			controlCommands = new Command[6];
			commandsInUse = 0;
		}