| 65 | } |
| 66 | |
| 67 | void HighDensityDisplayApp::draw() |
| 68 | { |
| 69 | gl::clear( Color( 0.1f, 0.1f, 0.15f ) ); |
| 70 | gl::enableAlphaBlending(); |
| 71 | |
| 72 | gl::pushModelMatrix(); |
| 73 | gl::color( 1.0f, 0.5f, 0.25f ); |
| 74 | gl::lineWidth( toPixels( 1.0f ) ); |
| 75 | gl::draw( mPoints ); |
| 76 | gl::popModelMatrix(); |
| 77 | |
| 78 | // rotate a 200x200pt square at the center of the window |
| 79 | gl::pushModelMatrix(); |
| 80 | gl::color( 1.0f, 0.2f, 0.15f ); |
| 81 | gl::translate( getWindowCenter() ); |
| 82 | gl::rotate( float(getElapsedSeconds() / 10) ); |
| 83 | gl::drawSolidRect( Rectf( Area( -100, -100, 100, 100 ) ) ); |
| 84 | gl::popModelMatrix(); |
| 85 | |
| 86 | // draw the logo in the lower-left corner at 64x64 points |
| 87 | gl::color( Color::white() ); |
| 88 | gl::draw( mLogo, Rectf( 0, getWindowHeight() - 64, 64, getWindowHeight() ) ); |
| 89 | |
| 90 | // The font has been made double the size we need for non-Retina, so we always scale by 0.5f |
| 91 | // another strategy would be to use two different TextureFonts |
| 92 | std::string s = ( getWindowContentScale() > 1.0f ) ? "High Density" : "Non-High Density"; |
| 93 | float stringWidth = mFont->measureString( s ).x * 0.5f; |
| 94 | mFont->drawString( s, vec2( getWindowWidth() - stringWidth - 12, getWindowHeight() - 12 ), |
| 95 | gl::TextureFont::DrawOptions().scale( 0.5f ).pixelSnap( false ) ); |
| 96 | } |
| 97 | |
| 98 | CINDER_APP( HighDensityDisplayApp, RendererGl, prepareSettings ) |
nothing calls this directly
no test coverage detected