public void Draw()
        {
            foreach (KeyValuePair <string, IDrawn> drawable in drawList)
            {
                switch (drawable.Value.DrawnType)
                {
                case DrawnType.Animation:
                    Animation animation      = (Animation)drawable.Value;
                    Texture2D drawTexture    = textureManager.Textures[animation.Texture];
                    Rectangle frameRectangle = GameRectangle.ConvertToRectangle(animation.Frames[animation.Frame].TextureSource);
                    SpriteBatch.Draw(drawTexture, animation.GetPosition(), frameRectangle, Color.White, animation.Rotation, animation.GetOrigin(), animation.Scale, SpriteEffects.None, animation.Depth);
                    break;

                case DrawnType.Shape:
                    IDrawnShape shape = (IDrawnShape)drawable.Value;
                    switch (shape.Shape)
                    {
                    case ShapeType.Line:
                        DrawnLine drawLine = (DrawnLine)shape;
                        DrawLine(drawLine);
                        break;

                    case ShapeType.Rectangle:
                        DrawnRectangle drawRectangle = (DrawnRectangle)shape;
                        DrawRectangle(drawRectangle);
                        break;
                    }
                    break;

                case DrawnType.String:
                    DrawnString drawString = (DrawnString)drawable.Value;
                    DrawString(drawString);
                    break;
                }
            }
        }
Beispiel #2
0
 public Frame(GameRectangle textureSource)
 {
     TextureSource = textureSource;
 }
Beispiel #3
0
 public Frame(GameRectangle textureSource)
 {
     TextureSource = textureSource;
 }
 public static Rectangle ConvertToRectangle(GameRectangle rectangle)
 {
     return(ConvertToRectangle(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height));
 }
 public static Rectangle ConvertToRectangle(GameRectangle rectangle)
 {
     return ConvertToRectangle(rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
 }