Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Gosu text consistency
- By TheOm3ga Date 2010-06-09 22:04
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-10 02:05
I always just do like the Tutorial does and color the text by using the color argument to draw. Is there a use case for not doing that? I was actually even thinking about kicking out the color argument to drawText because I didn't remember it being used ^^"
- - 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.
Parent - - By ell Date 2010-06-17 20:52
Awfully sorry about an off-topic post, but what is the font you used for the source code in that last screen shot?
Parent - By erisdiscord Date 2010-06-17 22:47
Looks like Monaco; I'm not sure if it's available for Windows since it's an Apple typeface.
Parent - By BlueScope Date 2010-06-18 17:37
It doesn't seem to cost anything, as it's featured on quite a lot of locations... such as http://www.fonts101.com/fonts/view/Uncategorized/51239/Monaco.aspx (TrueType Font)
Parent - By TheOm3ga Date 2010-07-02 09:06
You rock!
Up Topic Gosu / Gosu Exchange / Gosu text consistency

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill