Ejemplo n.º 1
0
 /// <summary>
 /// Draws a triangle
 /// </summary>
 /// <param name="pt1">First point</param>
 /// <param name="pt2">Second point</param>
 /// <param name="pt3">Third point</param>
 /// <param name="c">Color to draw with</param>
 public void DrawTriangle(Point pt1, Point pt2, Point pt3, Color c)
 {
     renderTarget.SetTexture(null);
     renderTarget.AddPoint(pt1.X, pt1.Y, pt1.Z, 0, 1, c.R, c.G, c.B, c.A);
     renderTarget.AddPoint(pt2.X, pt2.Y, pt3.Z, 0, 0, c.R, c.G, c.B, c.A);
     renderTarget.AddPoint(pt3.X, pt3.Y, pt3.Z, 1, 0, c.R, c.G, c.B, c.A);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Draw a sprite
 /// </summary>
 /// <param name="s">Sprite to draw</param>
 /// <param name="x">X coordinate to draw at</param>
 /// <param name="y">Y coordinate to draw at</param>
 /// <param name="scale">Scale factor</param>
 /// <param name="color">Color to multiply with</param>
 public void DrawSprite(Sprite s, int x, int y, float scale, Color color)
 {
     renderTarget.SetTexture(s.Texture);
     renderTarget.AddPoint(x, y, 0, s.TextureCoords[0], s.TextureCoords[1], color.R, color.G, color.B, color.A);
     renderTarget.AddPoint(x, y + s.Height * scale, 0, s.TextureCoords[2], s.TextureCoords[3], color.R, color.G, color.B, color.A);
     renderTarget.AddPoint(x + s.Width * scale, y + s.Height * scale, 0, s.TextureCoords[4], s.TextureCoords[5], color.R, color.G, color.B, color.A);
     renderTarget.AddPoint(x + s.Width * scale, y + s.Height * scale, 0, s.TextureCoords[4], s.TextureCoords[5], color.R, color.G, color.B, color.A);
     renderTarget.AddPoint(x + s.Width * scale, y, 0, s.TextureCoords[6], s.TextureCoords[7], color.R, color.G, color.B, color.A);
     renderTarget.AddPoint(x, y, 0, s.TextureCoords[0], s.TextureCoords[1], color.R, color.G, color.B, color.A);
 }