Example #1
0
 public void DrawBox(Rect rect, Color color)
 {
     TextureRenderer.ColoredVertex[] data = new TextureRenderer.ColoredVertex[]
     {
         new TextureRenderer.ColoredVertex((float)rect.X, (float)rect.Y, color),
         new TextureRenderer.ColoredVertex((float)(rect.X + rect.W), (float)rect.Y, color),
         new TextureRenderer.ColoredVertex((float)(rect.X + rect.W), (float)(rect.Y + rect.H), color),
         new TextureRenderer.ColoredVertex((float)rect.X, (float)(rect.Y + rect.H), color)
     };
     this.dx.SetTexture(0, null);
     SendVerticesToDevice(data, 2, PrimitiveType.TriangleFan, TextureRenderer.ColoredVertex.VertexElements);
 }
Example #2
0
        public void DrawHollowBox(Rect rect, int frameWidth, Color color)
        {
            var p1 = new TextureRenderer.ColoredVertex((float)rect.X, (float)rect.Y, color);
            var p2 = new TextureRenderer.ColoredVertex((float)(rect.X + rect.W), (float)rect.Y, color);
            var p3 = new TextureRenderer.ColoredVertex((float)(rect.X + rect.W), (float)(rect.Y + rect.H), color);
            var p4 = new TextureRenderer.ColoredVertex((float)rect.X, (float)(rect.Y + rect.H), color);

            var p5 = new TextureRenderer.ColoredVertex((float)rect.X + frameWidth, (float)rect.Y + frameWidth, color);
            var p6 = new TextureRenderer.ColoredVertex((float)(rect.X + rect.W) - frameWidth, (float)rect.Y + frameWidth, color);
            var p7 = new TextureRenderer.ColoredVertex((float)(rect.X + rect.W) - frameWidth, (float)(rect.Y + rect.H) - frameWidth, color);
            var p8 = new TextureRenderer.ColoredVertex((float)rect.X + frameWidth, (float)(rect.Y + rect.H) - frameWidth, color);

            TextureRenderer.ColoredVertex[] data = new TextureRenderer.ColoredVertex[] { p1, p5, p2, p6, p3, p7, p4, p8, p1, p5 };
            this.dx.SetTexture(0, null);
            SendVerticesToDevice(data, 8, PrimitiveType.TriangleStrip, ColoredVertex.VertexElements);
        }
Example #3
0
 public ColoredVertex(float x, float y, Color color)
 {
     this = new TextureRenderer.ColoredVertex(x, y, 0f, color);
 }