FontChar *Font::Draw(int character, float x, float y) { FontChar *c = GetChar(character); if (c != NULL) { c->Draw(x,y,sx,sy); } else { //printf("not found\n"); } return c; }
void Font::Draw(std::string str, float x, float y) { for(int i=0; i<str.length(); i++) { FontChar *c = GetChar(str.at(i)); if (!c) continue; c->Draw(x,y,sx,sy); x+=(c->AdvanceX() >> 6) * sx; y+=(c->AdvanceY() >> 6) * sy; } }
void BitmapFont::Draw(std::string str, float x, float y) { for(int i=0; i<str.length(); i++) { FontChar *c = GetChar(str.at(i)); if (!c) { continue; } //printf("%c at %f,%f\n",str.at(i),x,y); c->Draw(x,y,sx,sy); x+=c->AdvanceX() * sx; //y+=c->AdvanceY(); } }