DragonFireSDK Forum

Programming Discussions => Non-Game Programming => Topic started by: leifab on April 17, 2012, 08:31:45 am

Title: Printing long text to screen
Post by: leifab on April 17, 2012, 08:31:45 am
Hi!

Someone who can give my any hint how to write a long text from char array into the screen in multiple lines using TextAdd?

/Leif-Arne
Title: Re: Printing long text to screen
Post by: budershank on April 17, 2012, 09:00:20 am
Depending on your needs, you can use the NoteAdd that was introduced in 2.0  It handles word wrapping for you.  Unfortunately it doesn't support fonts really.

Using the TextAdd you will want to insert a \n inside your array where you want the lines to break.  If you are doing this just for word wrapping purposes then you can iterate through the array and insert the \n at the desired length. 
Title: Re: Printing long text to screen
Post by: korn3l on April 17, 2012, 09:57:43 am
I use a Symbol where i want to make a line break and print it like this:

Code: [Select]
int mytext[10];
int i=0;
char * pch;
pch = strtok ("your text;goes;here",";");
 
  while (pch != NULL)
  {
mytext[i]=TextAdd(posx,posy,pch,font);
pch = strtok (NULL, ";");
i++;
        posy+=20;
}
I use this mehtod also for NetSend Responses and it works very good :)

~Kornel