Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Using a very basic/limited BBCode in AGK

Author
Message
Kevin Cross
21
Years of Service
User Offline
Joined: 15th Nov 2003
Location: London, UK
Posted: 20th Dec 2020 07:55 Edited at: 20th Dec 2020 18:36
Firstly I should mention that I didn't write this code but did rewrite it a little when trying to convert it for OryUI. Credit for this goes to Virtual Nomad.

I was going to add this to OryUI and still hope to, but it was more difficult then expected because OryUI has a wrap text function which breaks text strings up across multiple lines, and that unfortunately destroys the BBCode formatting. Needs a rethink at a later date.

That aside I think it should still be shared as you've probably wanted an easier way to colour and bold characters in the middle of a string at some point.

That is all this code does, colours and bold characters with the tags [b] Bold [ / b] (without the spaces) and [c=#ff0000]Red Text[/c] or [c=255,0,0,100]Red Semi Transparent Text[/c].

I've updated the code to work with the OryUI color convert function which lets you type colours as hex or rgb. That function is included too.

As you can see in the code you can use the ConvertBBCode function (feel free to rename it) to create text, and update text. The update version is in the main do loop and happens when you press the space bar in the example below.



I've lifted this from an existing project so hopefully it's all present and works. Let me know if not.
OryUI - A WIP AGK2 UI Framework

Login to post a reply

Server time is: 2024-11-24 06:00:18
Your offset time is: 2024-11-24 06:00:18