void Bee::drawOn(sf::RenderTarget& target) const { //if (!isInHive_) //{ auto beeSprite = buildSprite(centre, rayon, texture_); if (( speed_.angle() >= M_PI/2) or (speed_.angle() <= -M_PI/2)) { beeSprite.scale(1, -1); } beeSprite.rotate(speed_.angle()/DEG_TO_RAD); target.draw(beeSprite); if(isDebugOn()) { //couleur et épaisseur du cercle dependent de l'état de mouvement de l'abeille sf::Color color = (getMoveMode()==Random) ? sf::Color::Black : sf::Color::Blue; double size (rayon+1); double thickness = (getMoveMode()==Random) ? 5 : 3; auto shape = buildAnnulus(centre, size, color, thickness); target.draw(shape); Vec2d affiche (centre.x,centre.y +20); auto const text = buildText(statestring_, affiche , getAppFont(), 10, sf::Color::White); target.draw(text); } //} }
TabDurationSymbol::TabDurationSymbol(Score* s, StaffTypeTablature * tab, TDuration::DurationType type, int dots) : Element(s) { setFlags(ELEMENT_MOVABLE | ELEMENT_SELECTABLE); setGenerated(true); _tab = tab; buildText(type, dots); }
void register_fps() { assert(!fps_txt); fps_txt = buildText(white, &fps_string); obj_set_update_frequency((dioneObject*)fps_txt, 100); /* TODO - WINDOW MANAGER */ fps_loc.x = SCREEN_WIDTH - 40; fps_loc.y = 0; fps_loc.h = 20; fps_loc.w = 20; fps_string = malloc(sizeof(char)*8); //"[ ] fps" sprintf(fps_string," fps"); }
void WorkerBee::drawDebug(sf::RenderTarget& target) const { std::string valueString; sf::Color color(sf::Color::Magenta); Vec2d position; double text_size(getAppEnv().getTextSize()); position.x = this->getPosition().x; position.y = this->getPosition().y + text_size; valueString = "Worker: energy " + to_nice_string(this->getEnergy()); sf::Text text = buildText(valueString, position, getAppFont(), text_size, color); target.draw(text); position.y = position.y + text_size; sf::Text status = buildText(this->getDebugStatus(), position, getAppFont(), text_size, color); target.draw(status); }
void GeneralGlyph::parseGlyphFromInput(const char *input) { Parser parser(input); parser.findGlyph(); while(parser.foundValidGlyph()) { switch(parser.getGlyphType()) { case Text: { buildText(parser.getBuffer1()); break; } case Frac: { buildFrac(parser.getBuffer1(),parser.getBuffer2()); break; } case Sqrt: { buildSqrt(parser.getBuffer1()); break; } case Root: { buildRoot(parser.getBuffer1(),parser.getBuffer2()); break; } case Subscript: { buildSubscript(parser.getBuffer1()); break; } case Superscript: { buildSuperscript(parser.getBuffer1()); break; } case Pi: { buildPi(); break; } default: { break; } } parser.findGlyph(); } }
cTexture *cAsciiFonts::buildTextWrapped(unsigned char font, const QCString &text, unsigned short maxWidth, unsigned short hue, bool shaded, enTextAlign align) { // Insert Newslines if the word would exceed the maxWidth boundary unsigned int lineLength = 0; QCString wrapped; unsigned int spaceWidth = 0; cSurface *sf = getCharacter(font, ' '); if (sf) { spaceWidth = sf->width(); } // Split into words using the spaces QStringList parts = QStringList::split(" ", text.data()); QStringList::const_iterator it; for (it = parts.begin(); it != parts.end(); ++it) { QString word = *it; bool first = (it == parts.begin()); unsigned int wordWidth = 0; unsigned int i; for (i = 0; i < word.length(); ++i) { cSurface *sf = getCharacter(font, word.at(i).latin1()); if (sf) { wordWidth += sf->width(); } } if (!first) { wordWidth += spaceWidth; } // Check if the word still fits if (lineLength > 0 && lineLength + wordWidth > maxWidth) { wrapped += "\n"; if (!first) { wordWidth -= spaceWidth; // We're not prepending the space anyway } lineLength = wordWidth; } else { if (!first) { wrapped += " "; } lineLength += wordWidth; } wrapped += word.latin1(); } return buildText(font, wrapped, hue, shaded, align); }
void ReadKkit::undump( const vector< string >& args) { if ( args[1] == "kpool" ) buildPool( args ); else if ( args[1] == "kreac" ) buildReac( args ); else if ( args[1] == "kenz" ) buildEnz( args ); else if ( args[1] == "text" ) buildText( args ); else if ( args[1] == "xplot" ) buildPlot( args ); else if ( args[1] == "xgraph" ) buildGraph( args ); else if ( args[1] == "group" ) buildGroup( args ); else if ( args[1] == "geometry" ) buildGeometry( args ); else if ( args[1] == "stim" ) buildStim( args ); else if ( args[1] == "xcoredraw" ) ; else if ( args[1] == "xtree" ) ; else if ( args[1] == "xtext" ) ; else if ( args[1] == "doqcsinfo" ) ; else if ( args[1] == "kchan" ) buildChan( args ); else if ( args[1] == "xtab" ) buildTable( args ); else cout << "ReadKkit::undump: Do not know how to build '" << args[1] << "'\n"; }