Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / Breaking text into lines

Author
Message
NathanF
20
Years of Service
User Offline
Joined: 24th Mar 2004
Location:
Posted: 30th Aug 2004 17:11
I just finished this handy little function that breaks up inputted text into lines, and texts it down on the inputted coordinates.
You need to arrange text like this to make it work:

yourstring$="Buy various vehicle parts »such as, launchers »and shields.»"

See how I put a » sign in certain places? That means the end of a line - you must also put one at the end.

Hope you find it useful.



-Formerly DarkSephiroth-
Sephnroth
22
Years of Service
User Offline
Joined: 10th Oct 2002
Location: United Kingdom
Posted: 4th Sep 2004 02:17
Unbelivably usful, thanks!

p4 2.4ghz, 768ddr ram, Geforce FX 5200
Innovate, redefine, recreate whats in your mind. It isnt fate, you decide, only you can cross that line.
Atreides
21
Years of Service
User Offline
Joined: 11th Oct 2003
Location: Switzerland (but NOT on a mountain !)
Posted: 4th Sep 2004 04:13 Edited at: 4th Sep 2004 04:18
if you look at my windows system, you can see a part of my code can cut a text between words (you don't have to add a special letter, it's automatic)
You just have to modify my code (look for the lines which draw the text of a label) to make a function like yours

http://forum.thegamecreators.com/?m=forum_view&t=35493&b=6

edit>
Here's the code that cut the text


As you can see, it isn't very long
gadget().x => position x
gadget().y => position y
gadget().width => width of the text
gadget().chaine => string of the gadget

In some cases, my way to cut the text may be better than yours, but in some others, yours is better => you could also mix them

The sleeper must awaken !
NathanF
20
Years of Service
User Offline
Joined: 24th Mar 2004
Location:
Posted: 4th Sep 2004 12:04
Yours looks good. Nice little interface you got there. I think mine's faster as it requires the special char (no searching for spaces), and yours is more user friendly (although is more complex). I don't have the time to make function right now, but after the comp while on my main project I'll check back here. Thanks for the comments (and the source)

-Formerly DarkSephiroth-

Login to post a reply

Server time is: 2024-11-23 19:22:42
Your offset time is: 2024-11-23 19:22:42