コード例 #1
0
ファイル: Game1.cs プロジェクト: J-O-K-E-R/Stern-Halma
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize() {
     // TODO: Add your initialization logic here
     inputManager = new InputListenerManager();
     this.IsMouseVisible = true;
     currentScreen = new Menu();
     base.Initialize();
 }
コード例 #2
0
ファイル: Game1.cs プロジェクト: J-O-K-E-R/Stern-Halma
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime) {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
                Exit();

            // TODO: Add your update logic here
            switch (currentScreen.Type) {
                case "Menu":
                    currentScreen = new Menu();
                    break;
                case "PreGame":
                    currentScreen = new PreGame();
                    break;
                case "Board":
                    currentScreen = new Board();
                    break;
                case "Setup":
                    currentScreen = new Setup();
                    break;
                case "Credit":
                    currentScreen = new Credits();
                    break;
            }
            currentScreen.Update(gameTime);
            base.Update(gameTime);
        }