DrawTexture() public method

Draws a Texture.
public DrawTexture ( SpriteSheet spriteSheet, Rectangle rectangle, Color color, float opacity = 1f ) : void
spriteSheet SpriteSheet The SpriteSheet.
rectangle Sharpex2D.Math.Rectangle The Rectangle.
color Color The Color.
opacity float The Opacity.
return void
Exemplo n.º 1
0
        /// <summary>
        /// Draws the Skybox.
        /// </summary>
        /// <param name="spriteBatch">The spriteBatch.</param>
        /// <param name="gameTime">The GameTime.</param>
        public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            spriteBatch.DrawTexture(_background, _backgroundPosition);

            spriteBatch.DrawTexture(_layer1, _layer1Position1);
            spriteBatch.DrawTexture(_layer2, _layer2Position1);

            spriteBatch.DrawTexture(_layer1, _layer1Position2);
            spriteBatch.DrawTexture(_layer2, _layer2Position2);

            //spriteBatch.DrawTexture(_layer1, _layer1Position3);
            spriteBatch.DrawTexture(_layer2, _layer2Position3);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Draws the Scene.
 /// </summary>
 /// <param name="spriteBatch">The spriteBatch.</param>
 /// <param name="gameTime">The GameTime.</param>
 public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
 {
     spriteBatch.DrawTexture(_background, _backgroundPosition);
     Vector2 dim =
         spriteBatch.MeasureString(
             string.Format("score: {0}", _finalScore), _font);
     Vector2 dim2 = spriteBatch.MeasureString("Press {Enter} to continue", _font2);
     Vector2 dim3 = spriteBatch.MeasureString(
         string.Format("(Achievement multiplier {0}x)", _achievmentMultiplier), _font3);
     spriteBatch.DrawString(
         string.Format("score: {0}", _finalScore), _font,
         new Vector2(400 - dim.X/2, 300), Color.White);
     spriteBatch.DrawString(string.Format("(Achievement multiplier {0}x)", _achievmentMultiplier), _font3,
         new Vector2(400 - dim3.X/2, 350), Color.White);
     spriteBatch.DrawString("Press {Enter} to continue", _font2, new Vector2(400 - dim2.X/2, 420), Color.White);
     _blackBlend.Draw(spriteBatch, gameTime);
 }
Exemplo n.º 3
0
        /// <summary>
        /// Draws the Player.
        /// </summary>
        /// <param name="spriteBatch">The spriteBatch.</param>
        /// <param name="gameTime">The GameTime.</param>
        public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            if (!_isVisible) return;

            spriteBatch.DrawTexture(Sprite, Position);

            //healthbar
            if (!EnableHPBar) return;

            spriteBatch.FillRectangle(Color.Red, _healthBarRed);
            spriteBatch.FillRectangle(Color.Green, _healthBarGreen);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Zeichnen der Elemente
 /// </summary>
 /// <param name="spriteBatch"></param>
 /// <param name="gameTime"></param>
 public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
 {
     spriteBatch.DrawTexture(Texture, Position);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Draws the Scene.
 /// </summary>
 /// <param name="spriteBatch">The spriteBatch.</param>
 /// <param name="gameTime">The GameTime.</param>
 public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
 {
     spriteBatch.DrawTexture(_menuBackground, _menuPosition);
     UIManager.Draw(spriteBatch, gameTime);
     _blackBlend.Draw(spriteBatch, gameTime);
 }
Exemplo n.º 6
0
        /// <summary>
        /// Draws the Player.
        /// </summary>
        /// <param name="spriteBatch">The spriteBatch.</param>
        /// <param name="gameTime">The GameTime.</param>
        public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            if (!_isVisible) return;

            spriteBatch.DrawTexture(Sprite, Position);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Draws the Player.
 /// </summary>
 /// <param name="spriteBatch">The spriteBatch.</param>
 /// <param name="gameTime">The GameTime.</param>
 public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
 {
     spriteBatch.DrawTexture(Sprite, Position);
 }
Exemplo n.º 8
0
        /// <summary>
        /// Draws the Minimap.
        /// </summary>
        /// <param name="spriteBatch">The spriteBatch.</param>
        /// <param name="gameTime">The GameTime.</param>
        public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            if (!Visible) return;

            spriteBatch.DrawTexture(_minimap, new Vector2(X, Y), 0.4f);

            foreach (Vector2 enemy in _enemyPositions)
            {
                spriteBatch.FillRectangle(Color.Red, new Rectangle(enemy.X, enemy.Y, 5, 5));
            }

            foreach (Vector2 projectile in _projectilePositions)
            {
                spriteBatch.FillRectangle(Color.Blue, new Rectangle(projectile.X, projectile.Y, 2, 2));
            }

            spriteBatch.FillRectangle(Color.Green, new Rectangle(_playerPosition.X, _playerPosition.Y, 5, 5));
        }