|
textprintf_ex |
Sylvarant
Member #7,886
October 2006
|
how do you divide an output in two lines using textprintf_ex.
|
miran
Member #2,407
June 2002
|
You call it twice with different y. Btw, are you sure you want to be a programmer? -- |
LennyLen
Member #5,313
December 2004
|
Quote: Btw, are you sure you want to be a programmer? Ouch. A multi-line text_printf function would be good though.
|
Sylvarant
Member #7,886
October 2006
|
Quote: Btw, are you sure you want to be a programmer?
that hurt.
|
miran
Member #2,407
June 2002
|
Hehe, I'm only messing with you. The point is, for programming you need a different way of thinking than for most other things in life. Otherwise you can bang your head against the desk for a whole day when the solution is really obvious... -- |
TeamTerradactyl
Member #7,733
September 2006
|
Adriaan Larmuseau said: textprintf_ex(window_bitmap,font,0,0,makecol(0,0,0),-1," testline 1 \n testline 2");
textprintf_ex(window_bitmap,font,0,0,makecol(0,0,0),-1," testline 1"); textprintf_ex(window_bitmap,font,0,12,makecol(0,0,0),-1," testline 2"); That would put what you want on separate lines. At this time, I'm not aware of multi-line textprintf_ex's. -TeamTerradactyl
|
LennyLen
Member #5,313
December 2004
|
Quote: As miran and LennyLen suggest, you will probably want to do something like this: textprintf_ex(window_bitmap,font,0,0,makecol(0,0,0),-1," testline 1"); textprintf_ex(window_bitmap,font,0,12,makecol(0,0,0),-1," testline 2"); That would put what you want on separate lines. At this time, I'm not aware of multi-line textprintf_ex's. Well, it was only Miran that suggested it. In any case, I'd probably change that code slightly to be more like this: #define LINE_SPACING 3 ... textprintf_ex(window_bitmap,font,0,0,makecol(0,0,0),-1," testline 1"); textprintf_ex(window_bitmap,font,0,(text_height(font) + LINE_SPACING),makecol(0,0,0),-1," testline 1");
|
TeamTerradactyl
Member #7,733
September 2006
|
Quote: Well, it was only Miran that suggested it. Quote: A multi-line text_printf function would be good though.
|
miran
Member #2,407
June 2002
|
You can easily make your own multiline textprintf function. Just use printf to print to a buffer, parse it with ustrtok with '\n' as the delimiter and use textprintf_ex to print individual lines, incrementing y at each step. If you also know how to use text_length, you can even implement different alignment methods, and if you want something extra, you can do wordwrapping as well. That last one is a little trickier though... -- |
|