Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Text Menu Function problem

This topic is 5816 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've created a flexible text menu function. It takes the following format: IN SIMPLE FORM: draw_menu_text(page size, color, x1, y1, x2, y2, text, header) IN DATATYPE FORM: draw_menu_text(real, rgb, adv, adv, adv, adv, string, string) page size is a variable used to cut up the text string, I'll explain it later. color is the background color of the window. the x and y coordinates position and size the window. text is the text the window will show and header is text it will show in smaller font at the top of the message (for example, if you're talking to someone and you want their name to come up like "Bob says:"). The problem really lies in displaying the text string. That page size variable is used in conjunction with the width of the window to let the program know how many characters can string it can string across each line. It then loops through an array and cut's up the text string, placing each peice in each index of the array (the array is called "Lines[]"). Then it loops again, displaying the lines stored in the Lines[] array. This works just fine. HERE'S THE PROBLEM WITH THAT. The string is cut up by character which leads to words being split between lines! Does anyone have any idea on how I could get the program to reiderate through the Lines[] array and shift the words back together? I really don't want to have to scrap the whole thing, the Lines[] array and all, so while suggestions for redoing the script are still welcome, I'd prefer an idea on how to work with what I have so far. Here's an example of what gets stored in the Lines[] array: Lines[0] = "This is a String. Wh" Lines[1] = "atever happened to t" Lines[2] = "hat substitute teach" Lines[3] = "er from last weak?" [edited by - Jackysan on August 15, 2002 5:19:46 PM] [edited by - Jackysan on August 15, 2002 9:34:20 PM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!