Пример #1
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here
            //texture = this.Content.Load<Texture2D>("Logo"); (No Longer Needed)
            gameContent = new Classes.GameContent(Content);

            // Get the screen dimensions. (To be honest? Probably don't need this...)
            //screenWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
            //screenHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;

            _graphics.PreferredBackBufferWidth = screenWidth;
            _graphics.PreferredBackBufferHeight = screenHeight;
            _graphics.ApplyChanges();
            
            // Create game objects
            int paddleX = (screenWidth - gameContent.imgPaddle.Width) / 2;   // Center the paddle on the screen
            int paddleY = screenHeight - 100;                               // Set paddle 100px from the bottom
            paddlePlayer = new Classes.Paddle(paddleX, paddleY, screenWidth, _spriteBatch, gameContent);  // Create the game paddle

            wall = new Classes.Wall(1,50, _spriteBatch, gameContent);

            gameBorder = new Classes.GameBorder(screenWidth, screenHeight, _spriteBatch, gameContent);

        }
Пример #2
0
        private SpriteBatch spriteBatch; //allows us to write on backbuffer when we need to draw self

        // The function of our paddle which the player can move.
        public Paddle(float x, float y, float screenWidth, SpriteBatch spriteBatch, GameContent gameContent)
        {
            xPos             = x;
            yPos             = y;
            imgPaddle        = gameContent.imgPaddle;
            Width            = imgPaddle.Width;
            Height           = imgPaddle.Height;
            this.spriteBatch = spriteBatch;
            ScreenWidth      = screenWidth;
        }
Пример #3
0
        private SpriteBatch spriteBatch; //allows us to write on backbuffer when we need to draw self

        // TODO: Figure out why Brick() needs a void, and why Paddle() doesn't.
        public Bricks(float x, float y, Color color, SpriteBatch spriteBatch, GameContent gameContent)
        {
            xPos             = x;
            yPos             = y;
            imgBrick         = gameContent.imgBrick;
            Width            = imgBrick.Width;
            Height           = imgBrick.Height;
            this.spriteBatch = spriteBatch;
            isVisible        = true;
            this.color       = color;
        }
Пример #4
0
        private SpriteBatch spriteBatch; //allows us to write on backbuffer when we need to draw self

        public GameBorder(float screenWidth, float screenHeight, SpriteBatch spriteBatch, GameContent gameContent)
        {
            Width            = screenWidth;
            Height           = screenHeight;
            imgPixel         = gameContent.imgPixel;
            this.spriteBatch = spriteBatch;
        }