Multiline TextBox - Ignition + FontMachine
Monkey Forums/Monkey Programming/Multiline TextBox - Ignition + FontMachine
| ||
I'm using FontMachine and Ignition. I haven't found a way to make the text multiline. I know someone made a hack to fontMachine to support this, but I can't find it now and it doesn't seem to be implemented into FontMachine yet. I can't find the ignition docs related to gui, however I tested with iGuiScrollBox, iGuiTextField,iGuiText but the text does not wrap for me. I'd prefer a Ignition GUI way, since then I can position the text box resolution independant. Is there a way? If not, any suggestions? |
| ||
it was me, should be in the code section I just did a quick override and hacked in some code to split the lines, but it's not overly efficient, I am sure that Zig has actually coded his own way more efficiant multi line method now, so it might be worth looking through the module again. think this is what your looking for. unless your talking about text input. http://www.monkeycoder.co.nz/Community/posts.php?topic=3207 |
| ||
Thanks! I'll use that if it turns out I can't use Ignition GUI to do it :) |
| ||
Latest FontMachine has a class that handles rendering of multiline text with wordwrap without having to recalculate everything per frame, and without creating substrings. You can see it here: https://code.google.com/p/fontmachine/ This is a sample using wordwrapp text: Import fontmachine Import mojo Function Main() Local g:= New Game End Class Game Extends App Field font:BitmapFont Field wrapedtext:WordWrapedText Method OnCreate() SetUpdateRate(60) font = New BitmapFont("smallfont.txt") wrapedtext = New WordWrapedText wrapedtext.Font = font Local text:= LoadString("sampletext.txt") If text = "" Then Error("Could not load text!") wrapedtext.Text = text wrapedtext.Width = 50 End Method OnUpdate() If KeyDown(KEY_A) Then wrapedtext.Width += 1 If KeyDown(KEY_S) Then wrapedtext.Width -= 1 End Method OnRender() Cls(255,255,255) font.DrawText("Press A or S to modify the wordwrapp area width", 0, 0) SetColor(200, 200, 200) DrawRect(100, 100, wrapedtext.Width, 5000) SetColor(255, 255, 255) wrapedtext.Draw(100, 100) End End |
| ||
I'v still not actually ported my own code over to use your new module yet ziggy this is a nice reminder that I really need to do it at some point. |
| ||
Maybe I can help? :) Do you need static text or input? |
| ||
Ziggy, two minor things. 1. It's "Wrapped" not "Wraped." :) To a native English speaker, the second one reads like "raped." 2. I use Jungle IDE's module updater, and you don't seem to have this wordwrap code in the version that grabs (13.03.11-000A). In fact, I had to dig a bit in your repo, because it's not in the module itself but in a subfolder... I expected it to be in the module itself. So in case others miss it like I did, maybe it should be with the main module, or there should be a txt file pointing to it or something? |
| ||
this has not been promoted to official yet. will do very soon. |
| ||
@Playniax - great, I need simple static text. Just like Ziggy posted, but with your awesome GUI controls :) |
| ||
Ziggy any reason your holding back on pushing out the release? |
| ||
@Taiphoz: Just willing to have tested a bit more. But I'll be releasing as an official "update" very soon |
| ||
It's been promoted to "stable" and an update is available. |
| ||
Thanks this is a very useful update and it works great.I was just wondering if there was any way to align the text to the center or to the right.Or is it just always aligned to the left. |
| ||
I was just wondering if there was any way to align the text to the center or to the right.Or is it just always aligned to the left. Not yet! |
| ||
Hey Tibit, did you get my mail? |
| ||
hi all, I bought Ignition X. in the package, I found the font framework from ignition AND the fontmachine from ziggy. Question: are they complementary ? Or is there an advantage to use one or the other ? Fontmachine work with the same font than the font converted by the tool from playnax ? Sorry for the questions, but as I'm just beginning to find a text-font framework to convert my old blitzmax games, I don't have a clear view now :-) Pit |
| ||
The Ignition X font tool only converts ttf fonts to a format that Igition X can use. Fontmachine can do more like edit the font, adding colors etc. Ignition X can handle both font formats. |
| ||
Hi playniax I decided to use the ignition framework as it offer what I want : the same functionalities than the font type of blitmax. And... it works ! My Class is now migrated and works as in Blitz ! :-) So... thanks ! Pit |