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

Method drawTextView

samples/iosKeyboard/src/iosKeyboardApp.cpp:145–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145void iosKeyboardApp::drawTextView( const TextView &textView )
146{
147 gl::color( Color( "PowderBlue" ) );
148 gl::drawSolidRect( textView.mBounds );
149
150 Color borderColor = textView.mIsSelected ? Color( "DodgerBlue" ) : Color( "DarkGray" );
151 gl::color( borderColor );
152 gl::drawStrokedRect( textView.mBounds );
153
154 Rectf fitRect = textView.getTextBounds();
155 vec2 offset( 0.0f, mFont.getAscent() );
156
157 TextBox tbox = TextBox().font( mFont ).size( fitRect.getWidth(), fitRect.getHeight() ).premultiplied();
158
159 if( textView.mText.empty() && ! textView.mIsSelected ) {
160 tbox.color( Color::gray( 0.6f ) ).text( textView.mPlacerholderText );
161 }
162 else {
163 tbox.color( Color( "FireBrick" ) ).text( textView.mText );
164 }
165 gl::color( Color::white() );
166
167 auto tex = gl::Texture::create( tbox.render() );
168 gl::draw( tex, fitRect.getUpperLeft() );
169}
170
171void iosKeyboardApp::layoutTextViews()
172{

Callers

nothing calls this directly

Calls 15

drawSolidRectFunction · 0.85
drawStrokedRectFunction · 0.85
TextBoxFunction · 0.85
grayFunction · 0.85
whiteFunction · 0.85
getTextBoundsMethod · 0.80
getAscentMethod · 0.80
colorMethod · 0.80
colorFunction · 0.50
ColorFunction · 0.50
createFunction · 0.50
drawFunction · 0.50

Tested by

no test coverage detected