No Game Engine Game Dev: Word Sleuth 029: Finish text clipping/wrapping, updating text edit cursor

2 months ago
3

Streamed on 2024-08-12 (https://www.twitch.tv/thediscouragerofhesitancy)

Game Engines are for sissies!

Today we ported the text clipping from Text to MultiLineText. This was a fairly straightforward copy/paste operation. Then we simplified: I replaced Text with MultiColorText everywhere, removed Text, then renamed MultiColorText to Text. Now we only have one thing that renders text.

With clipping done, I did text wrapping. There are some caveats around very long words, however, that still need to be addressed. The trick is to maintain a "last good wrapping point" as you march through the string, then if you walk off the edge, move everything after the last-good-wrapping-point to your current character to the next line and shift it to the start of the line and do your usual new-line processing.

After all those updates, the TextEdit cursor was unusable so I started updating it. I found that there are a lot more caveats to finding a cursor position with all the new multi-line and word wrapping support. We'll wrap that up tomorrow.

Loading 1 comment...