hey fellas,
edit: I changed my mind. I just want the player to type their name. I’ll just do the dumbest possible: accept only A-Z, space and backspace, no bullshit. if you have knowledge to share, I’d like to hear anyway.
uuuuh look I didn’t research much, but I want to make a text box in SDL2. something very simple, I don’t want to handle right-to-left text, but I will need to deal with accented vowels áàéíõã and çÇ.
so yeah there is all those functions described in SDL2/Tutorials-TextInput - SDL2 Wiki
but I don’t really get it. like, I don’t know what am I responsible for, what SDL does for me, and what the platform does for me.
the cursor. who draws the cursor? me? who moves the cursor around? if the user presses END, HOME, arrow keys, CTRL, clicks on the text box, who moves the cursor?
what about selection? do I paint the selected text? or does the system paint it?
how about deletion. do I handle deletion of characters?
I mean, if I do stuff, how will the system know I did those things? or maybe it doesn’t need to know and all works fine?
is there some library that could help me do those string operations? like, delete UTF-8 characters easily, iterate over characters etc.
also. I know that text boxes are one the hardest things to implement, and there are super complicated algorithms to handle all corner cases. like that one Firefox blog post where they detail their strenuous attempts to get it right: Text Rendering Hates You - Faultlore
finally. I haven’t sat down to write code, maybe when I do things will make sense. but so far I’m scared and hesitant