virtual void draw(RoundState& state) override { const auto& appParams = BleepoutParameters::get(); float radius = appParams.domeRadius * _radiusScale; ofPushMatrix(); ofPushStyle(); ofNoFill(); LineWidthAdjuster::setLineWidth(_lineWidth); ofSetColor(_color); _spinPulser.update(state.time); _spreadPulser.update(state.time); rotate3d(_spinPulser.value()); ofVec3f rotationStep = (_spreadOffset + _spreadPulser.value()) / _count; for (int i = 0; i < _count; ++i) { rotate3d(rotationStep); ofCircle(0, 0, 0, radius); } ofPopStyle(); ofPopMatrix(); }
void GLText::draw() { glEnable(GL_TEXTURE_2D); double pos=0; color.use(); sf::Texture texture(font->getTexture(size)); sf::Vector2u texsize=texture.getSize(); sf::Texture::bind(&texture); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); int min_back=0; for (unsigned int i=0; i<message.size(); ++i) { sf::Glyph glyph=font->getGlyph(message[i],size,false); if (i==0) min_back=glyph.bounds.top; if (min_back>glyph.bounds.top) min_back=glyph.bounds.top; } GLPoint poz=position; poz.x-=origin.x; poz.y-=origin.y; poz.z-=origin.z; for (unsigned int i=0; i<message.size(); ++i) { sf::Glyph glyph=font->getGlyph(message[i],size,false); if (message[i]==' ') glyph.bounds.width=size/4; glBegin(GL_POLYGON); glTexCoord2d(glyph.textureRect.left/double(texsize.x),glyph.textureRect.top/double(texsize.y)); GLPoint help(pos,glyph.bounds.top-min_back,0); rotate3d(help,rotation.x,rotation.y,rotation.z); help.x*=scale.x; help.y*=scale.y; help.z*=scale.z; help.x+=poz.x; help.y+=poz.y; help.z+=poz.z; help.use(); glTexCoord2d((glyph.textureRect.left+glyph.textureRect.width)/double(texsize.x),glyph.textureRect.top/double(texsize.y)); help=GLPoint(pos+glyph.bounds.width,glyph.bounds.top-min_back); rotate3d(help,rotation.x,rotation.y,rotation.z); help.x*=scale.x; help.y*=scale.y; help.z*=scale.z; help.x+=poz.x; help.y+=poz.y; help.z+=poz.z; help.use(); glTexCoord2d((glyph.textureRect.left+glyph.textureRect.width)/double(texsize.x),(glyph.textureRect.top+glyph.textureRect.height)/double(texsize.y)); help=GLPoint(pos+glyph.bounds.width,glyph.bounds.top-min_back+glyph.bounds.height); rotate3d(help,rotation.x,rotation.y,rotation.z); help.x*=scale.x; help.y*=scale.y; help.z*=scale.z; help.x+=poz.x; help.y+=poz.y; help.z+=poz.z; help.use(); glTexCoord2d(glyph.textureRect.left/double(texsize.x),(glyph.textureRect.top+glyph.textureRect.height)/double(texsize.y)); help=GLPoint(pos,glyph.bounds.top+glyph.bounds.height-min_back); rotate3d(help,rotation.x,rotation.y,rotation.z); help.x*=scale.x; help.y*=scale.y; help.z*=scale.z; help.x+=poz.x; help.y+=poz.y; help.z+=poz.z; help.use(); glEnd(); pos+=glyph.bounds.width; } sf::Texture::bind(NULL); glDisable(GL_TEXTURE_2D); }