예제 #1
0
        /// <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

            BasicSprite.SetBoundaries(new Viewport(new Rectangle(0, 0, 2100, 1620)));
            graphics.PreferredBackBufferWidth  = windowWidth;
            graphics.PreferredBackBufferHeight = windowHeight;
            graphics.ApplyChanges();
            Scene.setViewport(GraphicsDevice.Viewport);
            BasicGUIButton.SetLimitForNextPressing(0.1);
            the_menu = new Menu(the_file);
            //scene2 = new Scene2();
            //the_game_over_menu = new GameOver();
            //scene1 = new Scene1();
            //scene2 = new Scene2();
            //scene3 = new Scene3();
            //graphics.PreferredBackBufferHeight =253 ;
            //graphics.PreferredBackBufferWidth = 320;
            //graphics.ApplyChanges();
            base.Initialize();
        }
예제 #2
0
 protected override void Update(GameTime gameTime)
 {
     if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
     {
         Exit();
     }
     //scene2.Update(gameTime);
     if (the_menu != null)
     {
         the_menu.Update(gameTime);
         if (the_menu.isNewGamePressed())
         {
             SetScene1();
         }
         else if (the_menu.isContinueGamePressed())
         {
             SetFileLevel();
         }
         else if (the_menu.isExitPressed())
         {
             Exit();
         }
     }
     if (the_game_over != null)
     {
         the_game_over.Update(gameTime);
         if (the_game_over.isMainMenuPressed())
         {
             SetMainMenu();
         }
         else if (the_game_over.isRestartPressed())
         {
             SetFileLevel();
         }
     }
     if (the_win_menu != null)
     {
         the_win_menu.Update(gameTime);
         if (the_win_menu.isMainMenuPressed())
         {
             SetMainMenu();
         }
     }
     if (scene1 != null)
     {
         if (!scene1.Lost())
         {
             scene1.Update(gameTime);
         }
         else
         {
             SetGameOver();
         }
     }
     if (scene2 != null)
     {
         if (!scene2.Lost())
         {
             scene2.Update(gameTime);
         }
         else
         {
             SetGameOver();
         }
     }
     if (scene3 != null)
     {
         if (!scene3.Lost())
         {
             scene3.Update(gameTime);
         }
         else
         {
             SetGameOver();
         }
     }
     CheckIfSceneIsWonAndChange();
     BasicGUIButton.UpdateLimitForNextPressing(gameTime);
     //the_game_over_menu.Update(gameTime);
     //scene1.Update(gameTime);
     //scene2.Update(gameTime);
     //scene3.Update(gameTime);
     // TODO: Add your update logic here
     base.Update(gameTime);
 }