示例#1
0
        //Buffer for double buffering
        public GameBuffer Copy()
        {
            GameBuffer retn = new GameBuffer();
            retn.screen = this.screen.Copy();
            retn.state = this.state;
            if (this.players != null)
            {
                retn.players = new Player[2];
                this.players.CopyTo(retn.players, 0);
            }

            return retn;
        }
示例#2
0
        public SpacewarGame()
        {
            #if XBOX360
            // we might as well use the xbox in all its glory
            preferredWindowWidth = FixedDrawingWidth;
            preferredWindowHeight = FixedDrawingHeight;
            enableDrawScaling = false;
            #else
            enableDrawScaling = true;
            #endif

            this.graphics = new Microsoft.Xna.Framework.GraphicsDeviceManager(this);
            this.graphics.PreferredBackBufferWidth = preferredWindowWidth;
            this.graphics.PreferredBackBufferHeight = preferredWindowHeight;

            // Game should run as fast as possible.
            IsFixedTimeStep = false;

            //Start the Update thread
            updateThread = new Thread(new ThreadStart(UpdateThread));
            updateThread.Start();
            updateDone = new ManualResetEvent(true);
            renderBlock = new ManualResetEvent(true);
            UpdateBuff = new GameBuffer();
            UpdateBuff.state = GameState.Started;
        }