hi, i''m using more or less nehe''s method for printing text at the moment (by building a display list). i was wondering how i could go about making something like:
glPrint("hello\nthere");
output:
hello
there
and not
hello(some weird symbol here)there
thanks,
Scott
------------------------------------------------------------
Email
Website
"If you try and don''t succeed, destroy all evidence that you tried."
------------------------------------------------------------
printing text with line breaks
NeHe prepares his font class by creating a disply list recognizing the 256 ascii characters. ''\n'' is not an ascii character, it''s a software character used to determine line breaks.
To accomplish what you desire, you''d have to do this:
glPrint("line 1",0,0);
glPrint("line 2",0,16);
where 16 is the height of your characters.
~Main
==
Colt "MainRoach" McAnlis
Programmer
www.badheat.com/sinewave
To accomplish what you desire, you''d have to do this:
glPrint("line 1",0,0);
glPrint("line 2",0,16);
where 16 is the height of your characters.
~Main
==
Colt "MainRoach" McAnlis
Programmer
www.badheat.com/sinewave
==Colt "MainRoach" McAnlisGraphics Engineer - http://mainroach.blogspot.com
yeah, that''s about as much as i''ve figured out so far. the reason being is that in my gui i''ve got all the controls i want so far working, however i''d like to have a textbox that is capable of multipe lines. i was hoping to just use one char or string for the entire text box caption, but i couldn''t figure out how to have line breaks (ie: enter being pressed goes to the next line). would it be worthwhile to try having a char or string per each line of text? and just a simple int to hold the number of lines?
thanks,
Scott
------------------------------------------------------------
Email
Website
"If you try and don''t succeed, destroy all evidence that you tried."
------------------------------------------------------------
thanks,
Scott
------------------------------------------------------------
Website
"If you try and don''t succeed, destroy all evidence that you tried."
------------------------------------------------------------
so modify the glPrint method to do a raster line break on every \n character. i assume there''s some loop in the method looping through the characters in the string argument. so when it encounters a \n just have it move the raster down and back to the left the appropriate amounts
-me
-me
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement