Exemple #1
0
 public void Draw(SpriteBatch spriteBatch)
 {
     if (sprite != null)
     {
         //       spriteBatch.Draw(sprite, v_position, sourceRect, Color.White);
         spriteBatch.Draw(
             sprite, v_position, sourceRect, Color.White,
             rotation, origin, scale, SpriteEffects.None, depth);
     }
     else
     {
         origin     = TextureManager.GetTexture("temp").Bounds.Center.ToVector2();
         sourceRect = TextureManager.GetTexture("temp").Bounds;
         spriteBatch.Draw(TextureManager.GetTexture("temp"), v_position, sourceRect, Color.White,
                          rotation, origin, scale, SpriteEffects.None, depth);
     }
 }
Exemple #2
0
        public static void Draw(SpriteBatch spriteBatch)
        {
            //           spriteBatch.Draw(TextureManager.GetTexture("collTileset"),Vector2.Zero,Color.White);

            Rectangle sourceRect = new Rectangle();
            Vector2   position;

            sourceRect.Width  = tileWidth;
            sourceRect.Height = tileHeight;
            for (int y = 0; y < mapHeight; y++)
            {
                for (int x = 0; x < mapWidth; x++)
                {
                    if (levelCollisionList[y * mapWidth + x] > 1)
                    {
                        position.X   = x * tileWidth;
                        position.Y   = y * tileHeight;
                        sourceRect.X = tileWidth * (levelCollisionList[y * mapWidth + x] - 1);
                        spriteBatch.Draw(TextureManager.GetTexture("collTileset"), position, sourceRect, Color.White);
                    }
                }
            }
        }
Exemple #3
0
 public void SetSprite(string textureKey, Rectangle textRect)
 {
     sprite     = TextureManager.GetTexture(textureKey);
     sourceRect = textRect;
     origin     = sprite.Bounds.Center.ToVector2();
 }