Today I made a bunch of changes to the text editor. I added a movable cursor, re-added particle effects, and changed the method of drawing text.
- Particle effects: I used the idea of saving each letter’s screen position at draw time and creating the particles afterward.
- Cursor: This was pretty straight forward; I just changed all my add and delete operations to use the cursor position.
- New method of drawing text: instead of looping through each screen position, I loop through the letters. This makes handling line breaks much easier.
The hardest part was particle effects for deleted letters. The problem is, once the letter is deleted, where do I draw the particles?
I don’t reliably know the letter’s screen position until it’s drawn, but deleted letters aren’t drawn. What I ended up doing is referencing the letter left of the deleted letter, although this solution has its own problems.
Your data is processed in accordance with my privacy policy. Comments are manually approved and may take a while to appear.