MCPcopy Create free account
hub / github.com/cinder/Cinder / draw

Method draw

samples/_timeline/VisualDictionary/src/CenterState.cpp:70–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70void CenterState::draw()
71{
72 for( list<Circle>::iterator circleIt = mCircles.begin(); circleIt != mCircles.end(); ++circleIt ){
73 circleIt->draw( app::getWindowCenter() );
74 }
75
76 float radius = 140.0f;
77
78 // draw string
79 // biggest square that can fit in the circle is radius * sqrt(2) per side x^2 = (r^2)/2
80 const float squareSide = sqrtf( ( radius * radius ) / 2.0f );
81
82 float pixelScale = std::min( squareSide / mWordPixelLength, squareSide / 140 ) * 2.0f;
83 gl::TextureFont::DrawOptions options = gl::TextureFont::DrawOptions().scale( pixelScale ).pixelSnap( false );
84
85 const vec2 offset = vec2( -radius + ( radius * 2 - mWordPixelLength * pixelScale ) / 2, radius - (radius * 2.0f - 60 * pixelScale ) / 2 );
86
87 gl::color( ColorA( Color::black(), mTextAlpha * 0.5f ) );
88 sFont->drawString( mWord, mTextPos() + offset + vec2( pixelScale, pixelScale ) * 1.5f, options );
89
90 gl::color( ColorA( Color::white(), mTextAlpha ) );
91 sFont->drawString( mWord, mTextPos() + offset, options );
92}
93
94void CenterState::setFont( gl::TextureFontRef font )
95{

Callers

nothing calls this directly

Calls 10

getWindowCenterFunction · 0.85
DrawOptionsFunction · 0.85
blackFunction · 0.85
whiteFunction · 0.85
drawStringMethod · 0.80
minFunction · 0.50
colorFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
scaleMethod · 0.45

Tested by

no test coverage detected