Ejemplo n.º 1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            gameContent = new GameContent(Content);

            screenWidth  = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
            screenHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
            if (screenWidth >= 502)
            {
                screenWidth = 502;
            }
            if (screenHeight >= 700)
            {
                screenHeight = 700;
            }

            graphics.PreferredBackBufferWidth  = screenWidth;
            graphics.PreferredBackBufferHeight = screenHeight;
            graphics.ApplyChanges();

            int paddleX = (screenWidth - gameContent.imgPaddle.Width) / 2;
            int paddleY = (screenHeight - 100);

            paddle                 = new Paddle(paddleX, paddleY, screenWidth, spriteBatch, gameContent);
            wall                   = new Wall(1, 50, spriteBatch, gameContent);
            gameBorder             = new GameBorder(screenWidth, screenHeight, spriteBatch, gameContent);
            ball                   = new Ball(screenWidth, screenHeight, spriteBatch, gameContent);
            staticBall             = new Ball(screenWidth, screenHeight, spriteBatch, gameContent);
            staticBall.X           = 25;
            staticBall.Y           = 25;
            staticBall.Visible     = true;
            staticBall.UseRotation = false;
        }
Ejemplo n.º 2
0
 public GameState(GameBorder border)
 {
     this.border = border;
     init();
 }