Text input centered

Non-platform specific questions.

Text input centered

Postby JoeLopez » Thu May 22, 2014 12:01 pm

Hi I am trying to create a scenario in which a user types text into a speech bubble. I am hoping to format it so that as the user types, the text starts a new line in specific places (or after a specific number of characters) so that the text stays inside the bubble. Can anyone help me?? Loving game editor btw.
JoeLopez
 
Posts: 4
Joined: Fri May 02, 2014 1:47 am
Score: 0 Give a positive score

Re: Text input centered

Postby foleyjo » Mon Jun 09, 2014 11:18 am

Does your speech bubble have a set size and will each line in the speech bubble be different sized?

If set sized bubble you could have each line of the speach bubble as a different string.
Set a pointer to the firstline string and everytime the user inputs a character amend the string until you have reached the maximum number of characters.
Now set the pointer to the secondline string and repeat until all string lines have been maxed out.

Only thing that this won't deal with is when words are split over two lines. Maybe instead of doing it by letter you could do it by word. (using space character to check when the word is entered) and then compare the length of the new word with the spaces left in the current lines string. If the new word is greater then move onto the next line.
KISS -Keep It Simple Stoopid
foleyjo
 
Posts: 275
Joined: Mon Jul 09, 2007 1:15 pm
Score: 15 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron