2D game engine with rich text support

Started by
2 comments, last by FRex 7 years, 11 months ago

I'm interested in creating a 2D game that will contain a large amount of dialogue. I'm looking for a game library or 2D rendering library with good support for rich text. Specifically, I need to be able to change certain words to be different colors, and certain characters to be italic while other are non-italic, all in the same piece of text.

I'll also need a way to tell the width in pixels of a piece of text, so that I can determine when it's about to overflow the current line of the dialogue box. I'll be creating a line of dialogue by appending characters to it, one character at a time.

Has anyone had experiences with a library like this? I have tried things like SDL and SFML in past and they have no support for text operations like this. Sometimes it's hard just to get text which is properly anti-aliased.

I'm not interested in using a visual novel engine like Ren'Py because it's too limiting (my game will contain a lot more than just dialogue).

Advertisement

I dont know your preferred rendering API (GL/Vulkan/DX) but you may use this or adapt this one I found awhile ago on the net when searching for how to render debug text for my game engine as well.

https://github.com/podgorskiy/SimpleText

It has nearly anything you wished for in a way that you could follow what happens in the code more easy than in any other library I worked with

https://github.com/podgorskiy/SimpleText

It has nearly anything you wished for

Actually it's quite the opposite to what pflegit asked.

It doesn't return text width, and there's no attempts to calculate it.

There's single fixed-width bitmap font embedded. No way to use external fonts, no bold/italic styles.

Render is very inefficient, drawing single letter at a time, setting every letter position, fg/bg color, texture coordinates with a bunch of glUniform calls. It might practically kill app drawing lots of text.

Library's own texture/shaders/buffers management might not fit to hosting application's ecosystem.

In short - it's enough to quickly see debug messages in your GL sample app, but it's not the right tool for dialogue systems.

You could use SFML and use sf::Font directly to layout your text letter by letter yourself.

This topic is closed to new replies.

Advertisement