public SimpleUIColorIndicator(IUILayoutParam param, ColorPalette colorPalette, GLColor textColor, float min, float max, float step) { this.bar = new SimpleUIColorIndicatorBar(param, colorPalette, min, max, step); float[] coords = colorPalette.Coords; float coordLength = coords[coords.Length - 1] - coords[0]; this.numbers = new SimpleUIPointSpriteStringElement[coords.Length]; const float posY = -1.0f; this.numbers[0] = new SimpleUIPointSpriteStringElement( param, (-100.0f).ToShortString(), new vec3(-0.5f, posY, 0), textColor, 20); for (int i = 1; i < coords.Length; i++) { float x = (coords[i] - coords[0]) / coordLength - 0.5f; if (i + 1 == coords.Length) { var number = new SimpleUIPointSpriteStringElement(param, (100.0f).ToShortString(), new vec3(x, posY, 0), textColor, 20); this.numbers[i] = number; } else { var number = new SimpleUIPointSpriteStringElement(param, (-100.0f + i * (100 - (-100)) / 5).ToShortString(), new vec3(x, posY, 0), textColor, 20); this.numbers[i] = number; } } }
/// <summary> /// /// </summary> /// <param name="anchor">the edges of the viewport to which a SimpleUIRect is bound and determines how it is resized with its parent. /// <para>something like AnchorStyles.Left | AnchorStyles.Bottom.</para></param> /// <param name="margin">the space between viewport and SimpleRect.</param> /// <param name="size">Stores width when <see cref="OpenGLUIRect.Anchor"/>.Left & <see cref="OpenGLUIRect.Anchor"/>.Right is <see cref="OpenGLUIRect.Anchor"/>.None. /// <para> and height when <see cref="OpenGLUIRect.Anchor"/>.Top & <see cref="OpenGLUIRect.Anchor"/>.Bottom is <see cref="OpenGLUIRect.Anchor"/>.None.</para></param> /// <param name="zNear"></param> /// <param name="zFar"></param> /// <param name="rectColor">default color is red.</param> public SimpleUIColorIndicatorBar(IUILayoutParam param, ColorPalette colorPalette, float min, float max, float step) { IUILayout layout = this; layout.Param = param; this.ColorPalette = colorPalette; this.Min = min; this.Max = max; this.Step = step; }
public SimpleUIColorIndicator(IUILayoutParam param, ColorPalette colorPalette, GLColor textColor, float min, float max, float step) { this.bar = new SimpleUIColorIndicatorBar(param, colorPalette, min, max, step); }