Пример #1
0
 /// <summary>
 /// Renders a progress bar
 /// </summary>
 /// <param name="device">Device to render to</param>
 /// <param name="X">Location X</param>
 /// <param name="Y">Location Y</param>
 /// <param name="Width">Width of the bar</param>
 /// <param name="Height">Height of the bar</param>
 /// <param name="Progress">Amount of progress, floating point number between 0.0f (empty) and 1.0f (full)</param>
 /// <param name="skin">Skin used for the bar</param>
 public void RenderBar(GraphicsDevice device, float X, float Y, float Width, float Height, float Progress, int skin)
 {
     //SetTexture(BarTexture);
     SetTexture(WindowSkin);
     VertexPositionTexture[] bar = GFXUtility.Bar(device, X, Y, Width, Height, Progress, skin);
     device.DrawUserPrimitives <VertexPositionTexture>(PrimitiveType.TriangleList, bar, 0, 4);
 }
Пример #2
0
        /*
         * public static VertexPositionTexture[] Bar(GraphicsDevice device, float X, float Y, float Width, float Height, float Progress, int skin)
         * {
         *     // VertexPositionTexture[] dt = new VertexPositionTexture[6];
         *     float TA = 0;
         *     float TB = 1;
         *     float sxt = 0.0625f / 4f;
         *     Vector3 TL = GFXUtility.PixelToScreen(device, X, Y);
         *     Vector3 BL = GFXUtility.PixelToScreen(device, X, Y + Height);
         *     Vector3 TR = GFXUtility.PixelToScreen(device, X + Width, Y);
         *     Vector3 BR = GFXUtility.PixelToScreen(device, X + Width, Y + Height);
         *     Vector3 TM = GFXUtility.PixelToScreen(device, X + (int)(Progress * Width), Y);
         *     Vector3 BM = GFXUtility.PixelToScreen(device, X + (int)(Progress * Width), Y + Height);
         *     VertexPositionTexture[] dt = new VertexPositionTexture[12];
         *
         *     dt[0] = new VertexPositionTexture(TL, new Vector2(sxt * (1 + skin * 4), TA));
         *     dt[1] = new VertexPositionTexture(TM, new Vector2(sxt * (1 + skin * 4), TA));
         *     dt[2] = new VertexPositionTexture(BL, new Vector2(sxt * (1 + skin * 4), TB));
         *     dt[3] = new VertexPositionTexture(TM, new Vector2(sxt * (1 + skin * 4), TA));
         *     dt[4] = new VertexPositionTexture(BM, new Vector2(sxt * (1 + skin * 4), TB));
         *     dt[5] = new VertexPositionTexture(BL, new Vector2(sxt * (1 + skin * 4), TB));
         *     dt[6] = new VertexPositionTexture(TM, new Vector2(sxt * (3 + skin * 4), TA));
         *     dt[7] = new VertexPositionTexture(TR, new Vector2(sxt * (3 + skin * 4), TA));
         *     dt[8] = new VertexPositionTexture(BM, new Vector2(sxt * (3 + skin * 4), TB));
         *     dt[9] = new VertexPositionTexture(TR, new Vector2(sxt * (3 + skin * 4), TA));
         *     dt[10] = new VertexPositionTexture(BR, new Vector2(sxt * (3 + skin * 4), TB));
         *     dt[11] = new VertexPositionTexture(BM, new Vector2(sxt * (3 + skin * 4), TB));
         *
         *
         *     //eventually
         *     return dt;
         * }
         * //*/
        public static VertexPositionTexture[] Bar(GraphicsDevice device, float X, float Y, float Width, float Height, float Progress, int skin)
        {
            // VertexPositionTexture[] dt = new VertexPositionTexture[6];
            float TA = 0.5f;
            float TB = TA + 1.0f / 8.0f;
            // TA = 0;
            // TB = 1;
            float   sxt = 1f / 128f;//;0.0625f / 8f;
            Vector3 TL  = GFXUtility.PixelToScreen(device, X, Y);
            Vector3 BL  = GFXUtility.PixelToScreen(device, X, Y + Height);
            Vector3 TR  = GFXUtility.PixelToScreen(device, X + Width, Y);
            Vector3 BR  = GFXUtility.PixelToScreen(device, X + Width, Y + Height);
            Vector3 TM  = GFXUtility.PixelToScreen(device, X + (int)(Progress * Width), Y);
            Vector3 BM  = GFXUtility.PixelToScreen(device, X + (int)(Progress * Width), Y + Height);

            VertexPositionTexture[] dt = new VertexPositionTexture[12];

            dt[0]  = new VertexPositionTexture(TL, new Vector2(sxt * (1 + skin * 4), TA));
            dt[1]  = new VertexPositionTexture(TM, new Vector2(sxt * (1 + skin * 4), TA));
            dt[2]  = new VertexPositionTexture(BL, new Vector2(sxt * (1 + skin * 4), TB));
            dt[3]  = new VertexPositionTexture(TM, new Vector2(sxt * (1 + skin * 4), TA));
            dt[4]  = new VertexPositionTexture(BM, new Vector2(sxt * (1 + skin * 4), TB));
            dt[5]  = new VertexPositionTexture(BL, new Vector2(sxt * (1 + skin * 4), TB));
            dt[6]  = new VertexPositionTexture(TM, new Vector2(sxt * (3 + skin * 4), TA));
            dt[7]  = new VertexPositionTexture(TR, new Vector2(sxt * (3 + skin * 4), TA));
            dt[8]  = new VertexPositionTexture(BM, new Vector2(sxt * (3 + skin * 4), TB));
            dt[9]  = new VertexPositionTexture(TR, new Vector2(sxt * (3 + skin * 4), TA));
            dt[10] = new VertexPositionTexture(BR, new Vector2(sxt * (3 + skin * 4), TB));
            dt[11] = new VertexPositionTexture(BM, new Vector2(sxt * (3 + skin * 4), TB));


            //eventually
            return(dt);
        }
Пример #3
0
        public void RenderSmallIcon(GraphicsDevice device, float X, float Y, int Icon)
        {
            SetTexture(SmallIconMap);
            VertexPositionTexture[] j = GFXUtility.Icon(device, X, Y, Icon, 16);

            device.DrawUserPrimitives <VertexPositionTexture>(PrimitiveType.TriangleList, j, 0, 2);
        }
Пример #4
0
        public void RenderCloseButton(GraphicsDevice device, float X, float Y, bool Hot = false)
        {
            SetTexture(WindowSkin);
            Rect r = new Rect(48, Hot ? 16 : 0, 16, 16);

            VertexPositionTexture[] butt = GFXUtility.Quad(device, X, Y, 16, 16, r, WindowSkin);   // GFXUtility.CloseButton(device, X, Y, Hot);
            device.DrawUserPrimitives <VertexPositionTexture>(PrimitiveType.TriangleList, butt, 0, 2);
        }
Пример #5
0
        public void RenderButton(GraphicsDevice device, float X, float Y, float Width, float Height, bool Hot = false)
        {
            SetTexture(WindowSkin);
            Slice9 slice = new Slice9(80, Hot ? 24 : 0, 24, 24, 4);

            VertexPositionTexture[] frame = GFXUtility.SlicedQuad(device, X, Y, Width, Height, slice, WindowSkin);
            device.DrawUserPrimitives <VertexPositionTexture>(PrimitiveType.TriangleList, frame, 0, 18);
        }
Пример #6
0
 public void RenderFrame(GraphicsDevice device, float X, float Y, float Width, float Height, Slice9?slice = null)
 {
     SetTexture(WindowSkin);
     SetColour(Color.LightGray);
     if (!slice.HasValue)
     {
         slice = new Slice9(0, 0, 48, 48, 5, 5, 17, 5);
     }
     VertexPositionTexture[] frame = GFXUtility.SlicedQuad(device, X, Y, Width, Height, slice.GetValueOrDefault(), WindowSkin);// GFXUtility.Frame(device, X, Y, Width, Height);
     device.DrawUserPrimitives <VertexPositionTexture>(PrimitiveType.TriangleList, frame, 0, 18);
     SetColour(Color.Gray);
 }
Пример #7
0
        public void RenderClock(GraphicsDevice device, float X, float Y, float Progress, int Size = 32)
        {
            // GUIEffect.DiffuseColor = new Vector3(0.0f, 0.0f, 0.0f);
            // GUIEffect.Alpha = 0.7f;
            SetTexture(WindowSkin);
            SetColour(new Color(0, 0, 0), 0);
            VertexPositionTexture[] c = GFXUtility.Clock(device, X, Y, Progress, Size);
            device.DrawUserPrimitives <VertexPositionTexture>(PrimitiveType.TriangleList, c, 0, c.Length / 3);
            SetColour(Color.Gray);

            // GUIEffect.DiffuseColor = new Vector3(1,1,1);
            // GUIEffect.Alpha = 2.0f;
        }
Пример #8
0
 public void RenderBox(GraphicsDevice device, float X, float Y, float Width, float Height)
 {
     SetTexture(WindowSkin);
     VertexPositionTexture[] b = GFXUtility.Box(device, X, Y, Width, Height);
     device.DrawUserPrimitives <VertexPositionTexture>(PrimitiveType.TriangleList, b, 0, 6);
 }
Пример #9
0
 public void RenderIconEx(GraphicsDevice device, float X, float Y, int Icon)
 {
     // SetTexture(bagIcons);
     VertexPositionTexture[] i = GFXUtility.Icon(device, X, Y, Icon);
     device.DrawUserPrimitives <VertexPositionTexture>(PrimitiveType.TriangleList, i, 0, 2);
 }
Пример #10
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);
 }
Пример #11
0
 public void RenderTexturedQuad(GraphicsDevice device, float X, float Y, float W, float H, Texture2D Texture)
 {
     SetTexture(Texture);
     VertexPositionTexture[] c = GFXUtility.Quad(device, X, Y, W, H);
     device.DrawUserPrimitives <VertexPositionTexture>(PrimitiveType.TriangleList, c, 0, c.Length / 3);
 }