public void DrawSprite(Sprite sprite)
        {
            if (sprite.Texture.Id == _currentTextureId)
            {
                _batch.AddSprite(sprite);
            }
            else
            {
                _batch.Draw(); // Draw all with current texture

                // Update texture info
                _currentTextureId = sprite.Texture.Id;
                Gl.glBindTexture(Gl.GL_TEXTURE_2D, _currentTextureId);
                _batch.AddSprite(sprite);
            }
        }
Exemplo n.º 2
0
        public override void Draw(GameTime gameTime)
        {
            if (Draws)
            {
                #region Flashing

                //CurrentGameTime = gameTime.TotalGameTime.TotalSeconds;

                //if (CurrentGameTime - PreviousGameTime > 0.25)
                // {
                //    BCol = new Color((float)Rand.NextDouble(), (float)Rand.NextDouble(), (float)Rand.NextDouble());
                //    PreviousGameTime = CurrentGameTime;
                // }


                //Game1.Manager.GraphicsDevice.Clear(BCol);


                Game1.Manager.GraphicsDevice.Clear(Color.CornflowerBlue);

                #endregion

                Batch.Begin();

                //Draw Background
                Batch.Draw(Backgrounds[Bindex].Value, Vector2.Zero, null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0);

                //Draw Player
                if (OnLeftSide)
                {
                    Batch.Draw(Characters[Pleftindex].Value, PleftRectangle, null, Color.White, 0, Vector2.Zero, SpriteEffects.None, 0);
                }
                else
                {
                    Batch.Draw(Characters[Pleftindex].Value, PrightRectangle, null, Color.White, 0, Vector2.Zero, SpriteEffects.FlipHorizontally, 0);
                }

                //Draw Right Player
                //Batch.Draw(Characters[Prightindex].Value, PrightRectangle, null, Color.White, 0, Vector2.Zero, SpriteEffects.FlipHorizontally, 0);

                if (StartPressed)
                {
                    Batch.Draw(StartTripPressedTex, StartTripRectangle, null, new Color(255, 255, 255, 140), 0, Vector2.Zero, SpriteEffects.None, 0);
                }
                else
                {
                    Batch.Draw(StartTripTex, StartTripRectangle, null, new Color(255, 255, 255, 100), 0, Vector2.Zero, SpriteEffects.None, 0);
                }

                if (!Batch.IsDisposed)
                {
                    Batch.End();
                }
            }
        }
Exemplo n.º 3
0
        public override void Draw(GameTime gameTime)
        {
            if (Draws)
            {
                Game1.Manager.GraphicsDevice.Clear(Color.Green);

                Batch.Begin();

                Batch.Draw(Background, Vector2.Zero, Color.White);

                foreach (Entity e in Entities)
                {
                    e.Draw(gameTime, Batch);
                }

                Batch.End();
            }
        }