Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Hawkeye3

'Smart' text printing class

This topic is 5795 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey. I''ve been working on a modified version of GLPrint that NeHe uses in his tutorials and have been trying to add some features but I''m not quite sure how to go about it. First, what is a good way to make a non-fixedwidth font? It sort of looks funny when theres so much extra space between characters. Secondly, I have no idea how I would go about adding something like WordWrap. For example I define a rectangle and if the string is larger than what can fit to the edge, it goes to the next line. I was also wondering how games do those cool text effects like blending in the string one letter at a time. With the current text class that simply isn''t possible. I guess using an array of actual char structures instead of just a string would be a step in the right direction. I suppose I can keep trying myself but I imagine this is a rather common thing and someone more knowledgeable could give me some insight Thanks

Share this post


Link to post
Share on other sites
Advertisement
>>>...what is a good way to make a non-fixedwidth font...<<<
Do you mean like ''i'' is the same width as ''w''? If this is the case then you need per-char info on char width. If you''re using system fonts you can get this info from GetCharWidth32(...)

Wordwarp is actualy very simple. you have to tokanize text init words. Then for each word (before you draw it) see where it ends (sum up character lengths) and if its out of box go to next line.

fading in/out is not so easy if you want some fancy fx. [shameless plug I have so classes to work with this in my engine, along with windows TTF loading code. You can get it when NeHe uploades contest entry for MiniDemo contest. ]

You should never let your fears become the boundaries of your dreams.

Share this post


Link to post
Share on other sites
Hmm whats the performance hit like for using windows fonts in a game? Almost all of the games I see use actual bitmap files to render to the screen... Anyway, this looks to be a lot easier, I''ll have to study up on it.

Oh, and can''t wait to see your entry Darkwing

Thanks for the replies!

Share this post


Link to post
Share on other sites
quote:
Original post by Hawkeye3
Hmm whats the performance hit like for using windows fonts in a game?

none whatsoever, if you use them properly.


[edited by - niyaw on February 2, 2003 3:29:35 PM]

Share this post


Link to post
Share on other sites
there actualy is a (small) hit to performance rate whenusing a lot of system fonts. but it can be minimized by a simple trick. just render system fonts to texture and use them like bitmap fonts.

You should never let your fears become the boundaries of your dreams.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!