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 / Text Wrapping (2 functions) (both DBC and DBPro)

Author
Message
Underworld 1020
20
Years of Service
User Offline
Joined: 2nd Mar 2004
Location: NY, USA
Posted: 3rd Apr 2006 07:51 Edited at: 4th Apr 2006 08:13
EDIT: I've UPDATED the functions...look at the next post.

Hello everybody
I made up two functions that will allow you to use text wrapping in your DBC and DBPRO programs.

The First One:


The Second One:


The first function: returns the total number of lines that will be used to wrap the text within the xMax.
The second function: returns the text of a specfic line, be sure the line number is valid.

xMax: is the total text width of each line.
string$: is the entire string you wish to wrap.
getLine: is the number of the line you wish the get.

Here's an example:


Thats pretty much it. The only thing you have to watch out for is making sure that there isn't any single word that is greater than your xMax. If anybody finds a bug, let me know

Underworld 1020
20
Years of Service
User Offline
Joined: 2nd Mar 2004
Location: NY, USA
Posted: 4th Apr 2006 08:20 Edited at: 4th Apr 2006 08:27
I was looking around the fourms and found some text wrapping code by Phaelax. You can find the original code here:

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

Since, his code proved to much faster(i tested it ) and simpler, I decided to use the same idea in my functions. I simply took his code and modified it a little to make it fit the same exact format as my old functions. So for using the functions nothing has changed. And again these work for both DBC and DBPro.

Just simply use these functions instead.

The first One:


The second one:


Here's the same example with the updated functions:


So, use these functions in place of the old ones. How you use them is exactly the same.

Login to post a reply

Server time is: 2024-11-23 07:30:46
Your offset time is: 2024-11-23 07:30:46