示例#1
0
        public static VertexPositionTexture[] Quad(GraphicsDevice device, float X, float Y, float Width, float Height, Renderer.Rect TexMap, Texture2D WindowSkin)
        {
            VertexPositionTexture[] f = new VertexPositionTexture[6];
            int ML = TexMap.Left;
            int MR = TexMap.Right;
            int MT = TexMap.Top;
            int MB = TexMap.Bottom;

            Vector3 AA = PixelToScreen(device, X, Y);
            Vector3 AB = PixelToScreen(device, X + Width, Y);
            Vector3 BA = PixelToScreen(device, X, Y + Height);
            Vector3 BB = PixelToScreen(device, X + Width, Y + Height);

            VertexPositionTexture VAA = new VertexPositionTexture(AA, Renderer.TexelToCoord(ML, MT, WindowSkin));
            VertexPositionTexture VAB = new VertexPositionTexture(AB, Renderer.TexelToCoord(MR, MT, WindowSkin));
            VertexPositionTexture VBA = new VertexPositionTexture(BA, Renderer.TexelToCoord(ML, MB, WindowSkin));
            VertexPositionTexture VBB = new VertexPositionTexture(BB, Renderer.TexelToCoord(MR, MB, WindowSkin));

            f[0] = VAA;
            f[1] = VAB;
            f[2] = VBA;
            f[3] = VAB;
            f[4] = VBB;
            f[5] = VBA;

            return(f);
        }
示例#2
0
 public void RenderQuad(GraphicsDevice device, float X, float Y, float Width, float Height, Renderer.Rect TexMap)
 {
     SetTexture(WindowSkin);
     VertexPositionTexture[] butt = GFXUtility.Quad(device, X, Y, Width, Height, TexMap, WindowSkin);
     device.DrawUserPrimitives <VertexPositionTexture>(PrimitiveType.TriangleList, butt, 0, 2);
 }