| 33 | } |
| 34 | |
| 35 | void draw( float t ) const |
| 36 | { |
| 37 | // draw box and frame |
| 38 | gl::color( Color( 1.0f, 1.0f, 1.0f ) ); |
| 39 | gl::drawSolidRect( mDrawRect ); |
| 40 | gl::color( Color( 0.4f, 0.4f, 0.4f ) ); |
| 41 | gl::drawStrokedRect( mDrawRect ); |
| 42 | gl::color( Color::white() ); |
| 43 | gl::draw( mLabelTex, mDrawRect.getCenter() - vec2(mLabelTex->getSize()) / 2.0f ); |
| 44 | |
| 45 | // draw graph |
| 46 | gl::color( ColorA( 0.25f, 0.5f, 1.0f, 0.5f ) ); |
| 47 | |
| 48 | gl::begin( GL_LINE_STRIP ); |
| 49 | for( float x = 0; x < mDrawRect.getWidth(); x += 0.25f ) { |
| 50 | float y = 1.0f - mFn( x / mDrawRect.getWidth() ); |
| 51 | gl::vertex( vec2( x, y * mDrawRect.getHeight() ) + mDrawRect.getUpperLeft() ); |
| 52 | } |
| 53 | gl::end(); |
| 54 | |
| 55 | // draw animating circle |
| 56 | gl::color( Color( 1, 0.5f, 0.25f ) ); |
| 57 | gl::drawSolidCircle( mDrawRect.getUpperLeft() + mFn( t ) * mDrawRect.getSize(), 5.0f ); |
| 58 | } |
| 59 | |
| 60 | std::function<float (float)> mFn; |
| 61 | Rectf mDrawRect; |
nothing calls this directly
no test coverage detected