Inheritance: IComponent
Example #1
0
 /// <summary>
 /// Zeichnen der Elemente
 /// </summary>
 /// <param name="spriteBatch"></param>
 /// <param name="gameTime"></param>
 public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
 {            
     scoreBoard.Draw(spriteBatch, gameTime);
     ball.Draw(spriteBatch, gameTime);
     sL.Draw(spriteBatch, gameTime);
     sR.Draw(spriteBatch, gameTime);
 }
Example #2
0
 public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
 {
     p1Bounds = new Rectangle(new Vector2(0, 0), spriteBatch.MeasureString(scoreBoardPlayer1, Font));
     p2Bounds = new Rectangle(new Vector2(GraphicsDevice.BackBuffer.Width - spriteBatch.MeasureString(scoreBoardPlayer2, Font).X, 0), spriteBatch.MeasureString(scoreBoardPlayer2, Font));
     spriteBatch.DrawString(scoreBoardPlayer1, Font, p1Bounds, Color);
     spriteBatch.DrawString(scoreBoardPlayer2, Font, p2Bounds, Color);
 }
Example #3
0
 /// <summary>
 /// Draws the MenuButton.
 /// </summary>
 /// <param name="spriteBatch">The spriteBatch.</param>
 public override void OnDraw(SpriteBatch spriteBatch)
 {
     Vector2 dim = spriteBatch.MeasureString(Text, _font);
     spriteBatch.DrawString(Text, _font,
         new Vector2(Position.X - (dim.X/2) + (Size.Width/2), Position.Y - (dim.Y/2) + (Size.Height/2)),
         IsMouseHoverState ? Color.DarkOrange : Color.White);
 }
Example #4
0
        /// <summary>
        /// Zeichnen der Elemente
        /// </summary>
        /// <param name="spriteBatch"></param>
        /// <param name="gameTime"></param>
        public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            switch (SceneMode)
            {
                case SceneMode.FirstStart:
                    text = "Bereit?";
                    gameScene.Draw(spriteBatch, gameTime);
                    break;

                case SceneMode.Paused:
                    text = "Pausiert";
                    break;

                case SceneMode.WonLost:
                    break;

                case SceneMode.Scored:
                    text = "Bereit?";
                    gameScene.Draw(spriteBatch, gameTime);
                    break;

                default:
                    break;
            }
            font = new Font("Arial", 50, TypefaceStyle.Bold);
            position = new Vector2()
            {
                X = (graphicsDevice.BackBuffer.Width - spriteBatch.MeasureString(text, font).X) / 2,
                Y = 100
            };
            color = Color.White;
            spriteBatch.DrawString(text, font, position, color);
        }
Example #5
0
 public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
 {
     if (AnimationComplete)
     {
         return;
     }
     spriteBatch.DrawString(Text, Font, Position, Color.FromArgb((int)currentAlpha, 255, 255, 255));
 }
Example #6
0
 public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
 {
     if (!IsEnabled)
     {
         return;
     }
     spriteBatch.FillRectangle(Color.FromArgb((int)currentAlpha, 0, 0, 0), display);
 }
Example #7
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)
 {
     _skyBox.Draw(spriteBatch, gameTime);
     _entityComposer.Draw(spriteBatch, gameTime);
     if (!_debugDisplay.Visible)
     {
         _scoreBoard.Draw(spriteBatch, gameTime);
     }
     _minimap.Draw(spriteBatch, gameTime);
     _debugDisplay.Draw(spriteBatch, gameTime);
     _blackBlend.Draw(spriteBatch, gameTime);
     UIManager.Draw(spriteBatch, gameTime);
 }
Example #8
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);
        }
Example #9
0
 /// <summary>
 /// Zeichnen der Elemente
 /// </summary>
 /// <param name="spriteBatch"></param>
 /// <param name="gameTime"></param>
 public override void Draw(SpriteBatch spriteBatch, GameTime gameTime)
 {
     text1.Draw(spriteBatch, gameTime);
     if (text1.AnimationComplete)
     {
         text2.Draw(spriteBatch, gameTime);
         if (text2.AnimationComplete)
         {
             text3.Draw(spriteBatch, gameTime);
             if (text3.AnimationComplete)
             {
                 
             }
         }
     }
 }
Example #10
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);
 }
Example #11
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)
 {
     _skyBox.Draw(spriteBatch, gameTime);
     _fadeableText1.Draw(spriteBatch, gameTime);
     if (_fadeableText1.AnimationComplete)
     {
         _fadeableText2.Draw(spriteBatch, gameTime);
         if (_fadeableText2.AnimationComplete)
         {
             _fadeableText3.Draw(spriteBatch, gameTime);
             if (_fadeableText3.AnimationComplete)
             {
                 _blackBlend.Draw(spriteBatch, gameTime);
             }
         }
     }
 }
Example #12
0
        /// <summary>
        /// Draws the DebugDisplay.
        /// </summary>
        /// <param name="spriteBatch">The spriteBatch.</param>
        /// <param name="gameTime">The GameTime.</param>
        public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
        {
            if (!Visible) return;

            foreach (Enemy enemy in _currentEntityComposer.Enemies)
            {
                spriteBatch.DrawRectangle(_pen, enemy.Bounds);
            }

            foreach (Projectile projectile in _currentEntityComposer.Projectiles)
            {
                spriteBatch.DrawRectangle(_pen2, projectile.Bounds);
            }

            spriteBatch.DrawRectangle(_pen3, _currentEntityComposer.Player.Bounds);

            spriteBatch.DrawString(_debugMessage, _font, _display, Color.White);
        }
Example #13
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));
        }
Example #14
0
        public override void OnDraw(SpriteBatch spriteBatch)
        {
            if (this.IsMouseHoverState)
            {
                this.Pen.Color = Color.Yellow;
            }
            else
            {
                this.Pen.Color = Color.White;
            }

            float x = (float)(this.Position.X + (double)(this.Size.Width / 2) - spriteBatch.MeasureString(this.Text, this.Font).X / 2.0);
            float y = (float)(this.Position.Y + (double)(this.Size.Height / 2) - spriteBatch.MeasureString(this.Text, this.Font).Y / 2.0);
            Vector2 center = new Vector2(x, y);

            spriteBatch.DrawRectangle(this.Pen, Sharpex2D.Common.Extensions.UIBoundsExtension.ToRectangle(this.Bounds));
            spriteBatch.DrawString(this.Text, this.Font, center, Color.White);
        }
Example #15
0
        public override void OnDraw(SpriteBatch spriteBatch)
        {
            //if (AnimationComplete)
            //    return;

            if (this.IsMouseHoverState)
            {
                this.Pen.Color = Color.FromArgb((int)currentAlpha, 255, 255, 0);
            }
            else
            {
                this.Pen.Color = Color.FromArgb((int)currentAlpha, 255, 255, 255);
            }

            float x = (float)(this.Position.X + (double)(this.Size.Width / 2) - spriteBatch.MeasureString(this.Text, this.Font).X / 2.0);
            float y = (float)(this.Position.Y + (double)(this.Size.Height / 2) - spriteBatch.MeasureString(this.Text, this.Font).Y / 2.0);
            Vector2 center = new Vector2(x, y);

            spriteBatch.DrawRectangle(this.Pen, Sharpex2D.Common.Extensions.UIBoundsExtension.ToRectangle(this.Bounds));
            spriteBatch.DrawString(this.Text, this.Font, center, Color.FromArgb((int)currentAlpha, 255, 255, 255));
        }
Example #16
0
 /// <summary>
 /// Draws the enemies.
 /// </summary>
 /// <param name="spriteBatch">The spriteBatch.</param>
 /// <param name="gameTime">The GameTime.</param>
 private void DrawEnemies(SpriteBatch spriteBatch, GameTime gameTime)
 {
     foreach (Enemy t in Enemies)
     {
         t.Draw(spriteBatch, gameTime);
     }
 }
Example #17
0
 /// <summary>
 /// Processes a Render.
 /// </summary>
 /// <param name="spriteBatch">The SpriteBatch.</param>
 /// <param name="gameTime">The GameTime.</param>
 public abstract void Draw(SpriteBatch spriteBatch, GameTime gameTime);
Example #18
0
 /// <summary>
 /// Processes a Render.
 /// </summary>
 /// <param name="spriteBatch">The SpriteBatch.</param>
 /// <param name="gameTime">The GameTime.</param>
 public virtual void OnDrawing(SpriteBatch spriteBatch, GameTime gameTime)
 {
     spriteBatch.Begin();
     foreach (IGameComponent gameComponent in GameComponentManager)
     {
         gameComponent.Draw(spriteBatch, gameTime);
     }
     spriteBatch.End();
 }
Example #19
0
 /// <summary>
 /// Processes a Render.
 /// </summary>
 /// <param name="spriteBatch">The SpriteBatch.</param>
 /// <param name="gameTime">The GameTime.</param>
 void IDrawable.Draw(SpriteBatch spriteBatch, GameTime gameTime)
 {
     OnDrawing(spriteBatch, gameTime);
 }
Example #20
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);
 }
Example #21
0
 /// <summary>
 /// Draws the damage indicators.
 /// </summary>
 /// <param name="spriteBatch">The spriteBatch.</param>
 /// <param name="gameTime">The GameTime.</param>
 private void DrawDamageIndicators(SpriteBatch spriteBatch, GameTime gameTime)
 {
     foreach (var indicator in _scoreIndicators)
     {
         indicator.Draw(spriteBatch, gameTime);
     }
 }
Example #22
0
 /// <summary>
 /// Draws the EntityComposer.
 /// </summary>
 /// <param name="spriteBatch">The spriteBatch.</param>
 /// <param name="gameTime">The GameTime.</param>
 public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
 {
     Player.Draw(spriteBatch, gameTime);
     DrawEnemies(spriteBatch, gameTime);
     DrawProjectiles(spriteBatch, gameTime);
     DrawExplosions(spriteBatch, gameTime);
     DrawDamageIndicators(spriteBatch, gameTime);
 }
Example #23
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);
        }
Example #24
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);
 }
Example #25
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);
 }
Example #26
0
 /// <summary>
 /// Draws the projectiles.
 /// </summary>
 /// <param name="spriteBatch">The spriteBatch.</param>
 /// <param name="gameTime">The GameTime.</param>
 private void DrawExplosions(SpriteBatch spriteBatch, GameTime gameTime)
 {
     foreach (Explosion t in Explosions)
     {
         t.Draw(spriteBatch, gameTime);
     }
 }
Example #27
0
 /// <summary>
 /// Draws the BlackBlend.
 /// </summary>
 /// <param name="spriteBatch">The spriteBatch.</param>
 /// <param name="gameTime">The GameTime.</param>
 public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
 {
     if (!IsEnabled) return;
     spriteBatch.FillRectangle(Color.FromArgb(_alpha, 0, 0, 0), _display);
 }
Example #28
0
 /// <summary>
 /// Updates the game message.
 /// </summary>
 /// <param name="spriteBatch">The SpriteBatch.</param>
 /// <param name="gameTime">The GameTime.</param>
 private void DrawGameMessage(SpriteBatch spriteBatch, GameTime gameTime)
 {
     GameMessage.Instance.Draw(spriteBatch, gameTime);
 }
Example #29
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);
        }
Example #30
0
 /// <summary>
 /// Draws the projectiles.
 /// </summary>
 /// <param name="spriteBatch">The spriteBatch.</param>
 /// <param name="gameTime">The GameTime.</param>
 private void DrawProjectiles(SpriteBatch spriteBatch, GameTime gameTime)
 {
     foreach (Projectile t in Projectiles)
     {
         t.Draw(spriteBatch, gameTime);
     }
 }