Making custom message boxes
BlitzMax Forums/BlitzMax Programming/Making custom message boxes
| ||
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. |
| ||
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. |
| ||
It's in BB but this might help. |
| ||
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 |
| ||
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? |
| ||
Sorry I have been at work. It will take a string parameter. |
| ||
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).. |
| ||
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. |
| ||
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) |
| ||
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). |
| ||
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 |
| ||
Hey, that's really cool thanks! I think I can work with this. |