Making text do what i want it to do. sounds greedy huh.

Started by
13 comments, last by Nibbles 22 years, 6 months ago
Cool, I like that program! Thank you.

Now I just have to figure out how to use it in coding

Scott
Advertisement
I use this for text display, it has a console mode that might do what you are after. it may even have a wrapping feature im not aware of.


http://romka.demonews.com/projects/glf/index_eng.htm
www.EberKain.comThere it is, Television, Look Listen Kneel Pray.
just manuallly insert the \n in the string when you call your text output function. You already know where the \n should be so just put it there before you call the function
You only need the other way if you have no idea what the string is going to be so you dont know when to wrap it. But for your examples, you know what the string to output is gonna be and where it needs to be wrapped.


"I pity the fool, thug, or soul who tries to take over the world, then goes home crying to his momma."
- Mr. T
The average character width of a Windows Font can be found in the LOGFONT Win32 structure. This struct can be obtained about the current font that has been selected into the GDI with a call to GetTextMetrics(*Device Context*, *Address of LOGFONT structure you want to use*));
the actual variable you would want is something like AveCharWidth with the usual Hungarian prefixes.

-Brent Robinson
"The computer programmer is a creator of universes for which he alone is the lawgiver...No playwright, no stage director, no emperor, however powerful, has ever exercised such absolute athority to arrange a stage or a field of battle and to command such unswervingly dutiful actors or troops." - Joseph Weizenbaum-Brent Robinson
quote:Original post by ncsu121978
just manuallly insert the \n in the string when you call your text output function. You already know where the \n should be so just put it there before you call the function
You only need the other way if you have no idea what the string is going to be so you dont know when to wrap it. But for your examples, you know what the string to output is gonna be and where it needs to be wrapped.


"I pity the fool, thug, or soul who tries to take over the world, then goes home crying to his momma."
- Mr. T

It''s so much better to write a generic print-function that takes care of that automatically, because what if you want to change the text of the mission-objectives? You would have to re-run the program to see were the lines should break, and then re-insert new-lines in the text. Or what if you decide to use a different font, or change the size of the text-window?

It''s alot easier to just let the program worry about how to break long lines in the text (especially since it''s not difficult to implement).

This topic is closed to new replies.

Advertisement