Exemplo n.º 1
0
        public Game1()
        {
            this.Window.Title     = "Spectrum";
            graphics              = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            graphics.PreferredBackBufferHeight = 720;
            graphics.PreferredBackBufferWidth  = 1280;
            aaDisplay          = new Display(this);
            mManager           = new StateManager();
            mGame              = new State_GameState(this);
            mSplash            = new State_SplashState(this);
            mMainMenu          = new State_Menu_Main(this);
            mShipMenu          = new State_Menu_Ship(this);
            mInstructionsMenu  = new State_Menu_Instructions(this);
            mHighScoreMenu     = new State_Menu_HighScore(this);
            aaHSManager        = new GameIO();
            mGameSoundFX       = new List <SoundEffectInstance>();
            mGameSoundFXRemove = new List <SoundEffectInstance>();

            this.IsMouseVisible = true;

            Int64 performanceFrequency = 0;

            PerformanceTimer.QueryPerformanceFrequency(out performanceFrequency);
            secondsPerCount = 1.0f / (float)performanceFrequency;
            PerformanceTimer.QueryPerformanceCounter(out currentTimeStamp);
            previousTimeStamp = currentTimeStamp;
        }
Exemplo n.º 2
0
        protected override void Update(GameTime gameTime)
        {
            PerformanceTimer.QueryPerformanceCounter(out currentTimeStamp);
            float dt = (currentTimeStamp - previousTimeStamp) * secondsPerCount;

            // Allows the game to exitClass1.cs
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            if (mManager.GetCurrentState() == null)
            {
                mManager.ChangeState(mSplash);
            }

            mManager.UpdateState(dt);

            base.Update(gameTime);

            previousTimeStamp = currentTimeStamp;
        }