Hello,
I've been chatting about this on IRC, but I think it's worth writing it on the forum as well.
I think Gosu::createText is almost perfect, but I don't understand why it's got no color argument. "Use Gosu::drawText, it does have color" you may say; the problem is that drawText draws on an already initialized Bitmap, and createText creates that bitmap, automatically resizing it to properly fit the text.
Of course, I can do:
Gosu::Bitmap b;
b.resize(Gosu::textWidth(text, font, fontHeight), fontHeight);
Gosu::drawText(b, text, x, y, color, font, fontHeight);
But that's three lines, and those three lines are literally the ones that appear in Gosu::createText (from Text.cpp, lines 312-314). Just adding a fifth parameter to Gosu::createText would do the trick.
On IRC it was also said that I could use createText and then colorize the created image using .draw. Yep, but I would have to clutter my draw event with color logic, and I think the proper place to choose the color is the creation.
What do you think?
By jlnr (dev)
Date 2010-06-12 17:45
Circumventing this issue and others by beefing up Text support a bit (finally!!!). This will allow you to use everything with everything without flag bit masks, color arguments here and there, etc.
Loading...