Nez.Portable/UI/IMGUI.cs
/// <summary>
/// value should be between 0 and 1
/// </summary>
/// <returns>The bar.</returns>
/// <param name="value">Value.</param>
value should be between 0 and 1
value should be between 0 and 1
public static float progressBar(float value)
        {
            var thumbPos = _elementWidth * value;
            var color = SLIDER_THUMB_BG;
            if (isMouseOverElement())
            {
                if (Input.leftMouseButtonDown)
                {
                    var localMouseX = _mouseInWorldCoords.X - _elementX;
                    value = MathHelper.Clamp(localMouseX / _elementWidth, 0, 1);
                    thumbPos = _elementWidth * value;
                    color = SLIDER_THUMB_BG_DOWN;
                }
                else
                {
                    color = SLIDER_THUMB_BG_ACTIVE;
                }
            }
            _spriteBatch.drawRect(_elementX, _lastY + ELEMENT_PADDING, _elementWidth, ELEMENT_HEIGHT, SLIDER_BG);
            _spriteBatch.drawRect(_elementX, _lastY + ELEMENT_PADDING, thumbPos, ELEMENT_HEIGHT, color);
            drawString(value.ToString("F"), FONT_COLOR);
            endElement();
            return value;
        }
public static float progressBar ( float value ) { var thumbPos = _elementWidth * value ; var color = SLIDER_THUMB_BG ; if ( isMouseOverElement ( ) ) { if ( Input . leftMouseButtonDown ) { var localMouseX = _mouseInWorldCoords . X - _elementX ; value = MathHelper . Clamp ( localMouseX / _elementWidth , 0 , 1 ) ; thumbPos = _elementWidth * value ; color = SLIDER_THUMB_BG_DOWN ; } else { color = SLIDER_THUMB_BG_ACTIVE ; } } _spriteBatch . drawRect ( _elementX , _lastY + ELEMENT_PADDING , _elementWidth , ELEMENT_HEIGHT , SLIDER_BG ) ; _spriteBatch . drawRect ( _elementX , _lastY + ELEMENT_PADDING , thumbPos , ELEMENT_HEIGHT , color ) ; drawString ( value . ToString ( " " ) , FONT_COLOR ) ; endElement ( ) ; return value ; }
value should be between 0 and 1
value should be between 0 and 1
None
value
float
None