/// Draw the Slider
void Slider::draw() const
{
    if(showing)
    {
        if( type == HORIZONTAL )
        {
            gl::color( ColorA( 0.2,0.3,0.4, alpha) );
            gl::drawSolidRoundedRect( *this, 5.0, 32 );
          
            Rectf pctg_rect = Rectf( Vec2f( getX1(), getY1() ), Vec2f( getX1() + pctg*getWidth(), getY2() ) ) ;
            gl::color( color );
            gl::drawSolidRoundedRect( pctg_rect, 5.0, 32);
        }
        else if( type == VERTICAL )
        {
            gl::color( ColorA( 0.2,0.3,0.4, alpha) );
            gl::drawSolidRoundedRect( *this, 5.0, 32 );
           
            Rectf pctg_rect = Rectf( Vec2f( getX1(), getY2() - pctg*getHeight() ), Vec2f( getX2(), getY2() ) ) ;
            gl::color( color );
            gl::drawSolidRoundedRect( pctg_rect, 5.0, 32);
        }
        else if( type == CIRCULAR )
        {
            gl::color( ColorA( 0.2,0.3,0.4, alpha) );
            _drawArc( getCenter(), getWidth(), getHeight(), 0.0, 2*3.14159     , 10 );
            gl::color( color );
            _drawArc( getCenter(), getWidth(), getHeight(), 0.0, 2*3.14159*pctg, 7 );
        }
    }
}
Пример #2
0
void GoalRenderer::_drawElement(QPainter &painter, GoalElement* ele)
{   
    std::cout << "draing lvl: " << ele->getLevel()
              << " startangle: " << ele->getStartAngle()
              << " endangle: " << ele->getEndAngle() << std::endl;

    int w = m_pWidget->width();
    int h = m_pWidget->height();

    mRectSize = (w > h ? h : w);
    mRadius = CIRCLE_RADIUS_PER_LEVEL * ele->getLevel();
    mRectX = (mRectSize/2) - mRadius;
    mRectY = (mRectSize/2) - mRadius;
    mRectW = mRadius * 2;
    mRectH = mRadius * 2;

    _drawArc(painter, ele);
    _drawArcBorders(painter, ele);
}