PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Drawing multiple lines of text in Palm OS (tapwave zodiac)

Hi, I'm trying to draw some content that is multiple lines but have been having problems. For one, immediately after I sync the game to my zod, I run it (naturally). But the first time I run it, there are sometimes trailing chars at the end of the line. Like when I say "NOTHING" sometimes the "N" is at the end of one line whle NOTHING is at the beginning of another. This is fixed if I go to the launcher and launch it again :blink: Also, the last "?" is getting cut off and sometimes (yes, sometimes) the " it".

I know there are some flaws but this is the first time I made this kind of code. Whats wrong?

Here is the part of code I use to draw the text:

Code:
char LevelSynop[1][300] =
{
"So I'm just going to ramble on here about NOTHING. Isnt this game awesome? Yes. This game is also going to be awesome. This game will r0x0rz your b0x0rs. LOL! L-O-L = Laugh out Loud. Strange how teenagers can make up some strange things isnt it?"
};

...

Int32 width, slength, length, dLength;
UInt32 pointerPos, y, curPos;
Char *nString = NULL;
...
y = 25;
length = StrLen(LevelSynop[0]);
slength = length;
width = 480 - (20 * 2);
FontGetCharsInWidth(fontIDs[0], LevelSynop[0], &length;, &width;, NULL);
do
{
nString = (Char *)MemPtrNew(length + 1);
StrNCopy(nString, &LevelSynop;[0][pointerPos], length);
dLength = StrLen(nString);
if (nString[length] != ' ' && nString[length] != '.' && nString[length] != '?' && nString[length] != '!')
{
curPos = length;
do
{
curPos -= 1;
pointerPos -= 1;
slength += 1;
dLength -= 1;
} while (nString[curPos] != ' ' && nString[curPos] != '.' && nString[curPos] != '?' && nString[curPos] != '!');
pointerPos += 1;
slength -= 1;
dLength += 1;
}
FontDrawChars(fontIDs[0], nString, dLength, 20, y);
MemPtrFree(nString);
slength -= length;
y += 15;
pointerPos += length;
} while (slength > 0);
...
Have you seen the sticky post about lines of text in the gapidraw forum?

Of course, you say it works the second time around... So maybe something's not being initialized correctly.
You aren't initializing pointerPos.

Dan East
Dan East wrote:You aren't initializing pointerPos.

Dan East


I do, its just part of that "..." :roll: