The Alchemist Dev

Explorations & Rants

This exploration picks up from Text Rendering.

Now that I can display text, the next step is to figure out how to update it. As with the previous post, I'll update this page until I reach a good stopping point.

Deleting Characters


Updating Characters


Drawing and Moving a Cursor


Cursor Display and Editing


Moving and Deleting by Word



This looks like the best stopping point. To get here, I had to treat the TextField like a black box entity (not in the ECS sense) with an API. To move the cursor left, I simply call the struct's cursor_left() or cursor_left_by_word() functions. The field itself then becomes the argument for the viewport's draw_text_field(). This implemendation doesn't support anything you'd expect from a rich text editor like colors and weight. See the links below for how deep the rabbit hole really goes. I'm standing on the shoulders of giants over here.

Further Reading

Thanks for the slice.