示例#1
0
        public void DrawSprite(Sprite sprite, float x, float y)
        {
            var halfWidth  = sprite.texture.width / 2.0f;
            var halfHeight = sprite.texture.height / 2.0f;
            var p0         = sprite.TransformPoint(x + -halfWidth, y + -halfHeight);
            var p1         = sprite.TransformPoint(x + halfWidth, y + -halfHeight);
            var p2         = sprite.TransformPoint(x + -halfWidth, y + halfHeight);

            destPoints[0] = new PointF(p0.x, p0.y);
            destPoints[1] = new PointF(p1.x, p1.y);
            destPoints[2] = new PointF(p2.x, p2.y);
            graphics.DrawImage(sprite.texture.bitmap, destPoints);
        }
示例#2
0
        public void DrawSprite(Sprite sprite)
        {
            float   halfWidth  = sprite.texture.width / 2.0f;
            float   halfHeight = sprite.texture.height / 2.0f;
            Vector2 p0         = sprite.TransformPoint(-halfWidth, -halfHeight);
            Vector2 p1         = sprite.TransformPoint(halfWidth, -halfHeight);
            Vector2 p2         = sprite.TransformPoint(-halfWidth, halfHeight);

            destPoints[0] = new PointF(p0.x, p0.y);
            destPoints[1] = new PointF(p1.x, p1.y);
            destPoints[2] = new PointF(p2.x, p2.y);
            graphics.DrawImage(sprite.texture.bitmap, destPoints);
        }
示例#3
0
		public void DrawSprite(Sprite sprite) {
			float halfWidth = sprite.texture.width / 2.0f;
			float halfHeight = sprite.texture.height / 2.0f;
			Vector2 p0 = sprite.TransformPoint(-halfWidth, -halfHeight);
			Vector2 p1 = sprite.TransformPoint(halfWidth, -halfHeight);
			Vector2 p2 = sprite.TransformPoint(-halfWidth, halfHeight);
			destPoints[0] = new PointF(p0.x, p0.y);
			destPoints[1] = new PointF(p1.x, p1.y);
			destPoints[2] = new PointF(p2.x, p2.y);
			graphics.DrawImage(sprite.texture.bitmap, destPoints);
		}