Beispiel #1
0
        public void Draw(SpriteBatch b, Texture2D tex, Transform t, RectangleF rect, float layer)
        {
            Vector2 actualPos = DrawPosition(t);

            rect.Position = actualPos;

            b.Draw(tex, rect.ToRectangle(), null, Color.White, t.Rotation, Vector2.Zero, SpriteEffects.None, layer);
        }
Beispiel #2
0
 public Vector2 DrawPosition(Transform t)
 {
     return t.Position + Transform.Position;
 }
Beispiel #3
0
        public void Draw(SpriteBatch b, Texture2D texture, Transform transform, float layer, Rectangle? sourceRectangle = null)
        {
            Vector2 actualDraw = DrawPosition(transform);
            //RectangleF rect = new RectangleF((int)actualDraw.X, (int)actualDraw.Y, 
            //                               (int)(texture.Width * transform.Scale.X * CameraScale.X), 
            //                               (int)(texture.Height * transform.Scale.Y * CameraScale.X));
            Vector2 origin = Vector2.Zero;

            Model2D model = transform.GameObject.GetComponent<Model2D>();

            if(model != null)
            {
                origin = model.Origin;
            }

            SpriteEffects eff = model == null ? SpriteEffects.None : model.Effects;

            //b.Draw(texture, rect, null, Color.White, transform.Rotation, origin, SpriteEffects.None, layer);
            b.Draw(texture, actualDraw, sourceRectangle, Color.White, transform.Rotation, Vector2.Zero, transform.Scale * Camera.Instance.CameraScale, eff, layer);
        }