This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Multiple lines w/ text.


Multiple lines w/ text.

Postby wyrd » Jan 23, 2004 @ 1:37am

Is there any way to display text with multiple lines? I tried the typical \n for newline, but it doesn't work.

Thanks in advance.
wyrd
pm Member
 
Posts: 125
Joined: Jan 2, 2004 @ 10:19pm


Postby ppcStudios » Jan 23, 2004 @ 2:08am

G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby Guest » Jan 23, 2004 @ 2:32am

Guest
 


Postby wyrd » Jan 23, 2004 @ 2:32am

wyrd
pm Member
 
Posts: 125
Joined: Jan 2, 2004 @ 10:19pm


Postby mlepage » Jan 24, 2004 @ 4:29pm

www.scalenesoftware.com
Great games for your Palm and Pocket PC!
User avatar
mlepage
pm Insider
 
Posts: 1050
Joined: Aug 3, 2003 @ 4:47am
Location: Canada


Postby mlepage » Jan 24, 2004 @ 9:37pm

www.scalenesoftware.com
Great games for your Palm and Pocket PC!
User avatar
mlepage
pm Insider
 
Posts: 1050
Joined: Aug 3, 2003 @ 4:47am
Location: Canada


Postby wyrd » Jan 24, 2004 @ 10:13pm

wyrd
pm Member
 
Posts: 125
Joined: Jan 2, 2004 @ 10:19pm


Postby mlepage » Feb 9, 2004 @ 7:13pm

www.scalenesoftware.com
Great games for your Palm and Pocket PC!
User avatar
mlepage
pm Insider
 
Posts: 1050
Joined: Aug 3, 2003 @ 4:47am
Location: Canada


Postby Layre5150 » Feb 20, 2004 @ 2:09pm

Layre5150
pm Member
 
Posts: 21
Joined: Feb 13, 2004 @ 5:17pm


Postby Layre5150 » Feb 20, 2004 @ 2:16pm

Layre5150
pm Member
 
Posts: 21
Joined: Feb 13, 2004 @ 5:17pm


Postby ppcStudios » Feb 20, 2004 @ 3:36pm

G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby fzammetti » Feb 20, 2004 @ 3:38pm

...and so I said to Mr. Gates: "$640 billion should be enough for anyone!"
User avatar
fzammetti
pm Insider
 
Posts: 1496
Joined: Jun 4, 2002 @ 6:21pm
Location: Omnytex Technologies


Postby mlepage » Feb 20, 2004 @ 4:37pm

www.scalenesoftware.com
Great games for your Palm and Pocket PC!
User avatar
mlepage
pm Insider
 
Posts: 1050
Joined: Aug 3, 2003 @ 4:47am
Location: Canada


Postby Layre5150 » Feb 20, 2004 @ 10:26pm

Layre5150
pm Member
 
Posts: 21
Joined: Feb 13, 2004 @ 5:17pm


Postby mlepage » Feb 23, 2004 @ 7:19pm

What you say is mostly true.

Your code still tokenizes every line for every drawing when it need not do so. It also relies on newlines embedded in the text.

Another way is to tokenize once (using newlines in the file, or a width, or whatever) and store those as character indices, not newline characters. Then, when drawing, you need not recompute the indices, but merely draw the substrings from one index to the next as separate lines.

This is not really more complicated than what you have. And that approach lends itself well to resizing, because you need not alter your text, just the indices of where new lines are.

The function I wrote above will not scroll, and it isn't efficient because it also does computation for every draw that it need only do once. But it's sufficient for drawing text into a rectangle without manually predetermining where all the newlines should be. That's ideal during development, even if for release you change it to a static layout by figuring out where to place new lines.

The nice thing about these forums is that readers have so many different solutions to choose from. It never hurts to see different approaches. Also, they are commented so they make a good starting point even if you want to alter them into something different.
www.scalenesoftware.com
Great games for your Palm and Pocket PC!
User avatar
mlepage
pm Insider
 
Posts: 1050
Joined: Aug 3, 2003 @ 4:47am
Location: Canada


Next

Return to GapiDraw


Sort


Forum Description

The Cross-platform Graphics SDK for Palms, Pocket PCs, Symbian Devices, and Stationary PCs.

Moderators:

sponge, Johan

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum