Making custom message boxes

BlitzMax Forums/BlitzMax Programming/Making custom message boxes

Ryan Burnside(Posted 2006) [#1]
I'm looking for some help or some ideas on how to impliment a scrollable messagebox into my game. My problem is making the text scroll and fit within the message box area. If you have done this in the past or could show me a good way to do it I would greatly appreciate it.


Perhaps this can explain better.



PantsOn(Posted 2006) [#2]
pseudo code....

message = "hello from me"
newmessage = ""
y = 0

***
search for next [space] in message
if there isnt one
word = message
message = ""
else
word = everything before space in message
remove word+[space] from message
endif

if fontwidth(newmessage+[space]+word) > xlimit
print newmessage at yth line
newmessage = word
add 1 line to y
else
add [space] + word to newmessage
endif

repeat *** until nothing in message


I think.


tonyg(Posted 2006) [#3]
It's in BB but this might help.


CS_TBL(Posted 2006) [#4]
I've done something like that some weeks ago, works like a charm using maxGUI, but that's not going to stop a potential graphics-mode version..

but first diner :P


CS_TBL(Posted 2006) [#5]
So, exactly how should it work?

Since you're doing a game, I assume you're not using GUI I guess? But perhaps you do have the gui module for its events/eventhooks? (events so totally rock!)

Secondly, where does the text come from? From a string? From an incbin'ed textfile?


Ryan Burnside(Posted 2006) [#6]
Sorry I have been at work. It will take a string parameter.


CS_TBL(Posted 2006) [#7]
The string-format function is an easy one.. if you want me to make a displayer, I need to know whether or not I can use events (thus having MaxGUI)..


SculptureOfSoul(Posted 2006) [#8]
Unless I'm misunderstanding something about your approach CS_TBL, I don't know why you are concerned about MaxGUI. You don't need MaxGUI to utilize events or eventhooks in your code.


CS_TBL(Posted 2006) [#9]
uhm.. ok, not sure, I didn't have any Max until MaxGUI was released... does the standard bmax have the full eventsystem? (minus the GUI events naturally)


SculptureOfSoul(Posted 2006) [#10]
Yup.

At least, I don't think MaxGUI added anything besides GUI events. I've got a basic event system set up in one of my programs now, and don't have MaxGUI (...yet).


CS_TBL(Posted 2006) [#11]
I don't dare go into displayers as they're way too game-dependent, but the way I've solved the text-issue means you can use a typical 2d-mapviewer to display this text.

So, the only thing this does it put a string into a bank, wordwrapped. Note that tabs, newlines and such can be *stored* in a bank, but not *processed*. In these cases I recommend against them, just use spaces. ;P




Ryan Burnside(Posted 2006) [#12]
Hey, that's really cool thanks! I think I can work with this.