Esempio n. 1
0
        private void UpdateSize()
        {
            if (labelDirty)
            {
                if (Style.Font != null)
                {
                    textBuffer.BeginPrint();
                    textBuffer.LowPrint(0.0f, 0.0f, 0.0f, Label + ": 180.99");
                    textBuffer.EndPrint();
                    bounds.CopyFrom(textBuffer.FontStyle.Bounds);
                    FillBasePixels = bounds.Max + 2.0f * Style.Padding;
                }
                else
                {
                    FillBasePixels.X = 30;
                    FillBasePixels.Y = 10;
                }

                ninePatch.Place(0.0f, 0.0f, 0.0f, FillBasePixels.X, FillBasePixels.Y);
                labelDirty = false;
                valueDirty = true;
            }
            if (valueDirty && Style.Font != null)
            {
                textBuffer.BeginPrint();
                textBuffer.LowPrint(0.0f, 0.0f, 0.0f, Label + ": " + String.Format("{0:0.000}", CurrentDisplayValue));
                textBuffer.EndPrint();
            }
        }
Esempio n. 2
0
        private void UpdateSize()
        {
            if (dirty)
            {
                textBuffer.BeginPrint();
                textBuffer.LowPrint(0.0f, 0.0f, 0.0f, Label);
                textBuffer.EndPrint();
                bounds.CopyFrom(textBuffer.FontStyle.Bounds);

                FillBasePixels = bounds.Max + 2.0f * Style.Padding;

                ninePatch.Place(0.0f, 0.0f, 0.0f, FillBasePixels.X, FillBasePixels.Y);
                dirty = false;
            }
        }
Esempio n. 3
0
 public void Update()
 {
     if (
         (ninePatch.Size.X != Rect.Size.X) ||
         (ninePatch.Size.Y != Rect.Size.Y)
         )
     {
         ninePatch.Place(
             0.0f,
             0.0f,
             0.0f,
             Rect.Size.X,
             Rect.Size.Y
             );
     }
 }
Esempio n. 4
0
        public override void DrawSelf(IUIContext context)
        {
            /*  First draw ninepatch  */
#if false
            (Style.Material.Parameters.Values["texture"] as IParameterValue <Texture>).Value = ninePatch.NinePatchStyle.Texture;
            ninePatch.Place(Rect.Min.X, Rect.Min.Y, 0.0f, Rect.Max.X - Rect.Min.X, Rect.Max.Y - Rect.Min.Y);
            renderer.CurrentMesh = ninePatch.Mesh;
            renderer.RenderCurrent();

            GL.Disable(EnableCap.Blend);
            GL.Enable(EnableCap.CullFace);
#endif
            renderer.Push();

            if (Rect.Hit(context.Mouse))
            {
                if (context.MouseButtons[(int)(OpenTK.Input.MouseButton.Left)])
                {
                    //
                }
            }

            //Animate();

            renderer.CurrentGroup = group;

            GL.Disable(EnableCap.Blend);
            GL.Scissor(
                (int)(Rect.Min.X),
                (int)(Rect.Min.Y),
                (int)(Rect.Size.X),
                (int)(Rect.Size.Y)
                );
            GL.Enable(EnableCap.ScissorTest);

            renderer.Requested.MeshMode = MeshMode.PolygonFill;
            renderer.RenderGroup();

            GL.Disable(EnableCap.ScissorTest);
            GL.Enable(EnableCap.Blend);

            renderer.Pop();
        }