Hello.
I'm trying to code some text input, but after a long while of attempts and reading, I don't know what's the problem in my code.
In short, text_typed is getting no data (chars) appended to it. I know it's rendering properly because I can see the "A". Also, because I've once managed to accidentally append garbage, I know it is appending, so it's not a rendering issue. It is catching the key presses, I've tested with printfs to the console. The default for switch(key[ALLEGRO_EVENT_KEY_CHAR]) also does trigger, using the same trick.
Now what?
PS: As implied in the code, it'll have a caret and backspace/delete and enter support, but it's pointless to code now given I can't input any data.
PPS: Yes, part of the code is from https://www.allegro.cc/forums/thread/617234 .
switch(event.type) case ALLEGRO_EVENT_TIMER: switch(event.keyboard.keycode)
^^ I think you meant the .keycode switch to be under ALLEGRO_EVENT_KEY_CHAR?
I've done so many changes at the code by now... Yes, that's not quite "proper", given the esc key is outside, but it's in that way for rendering, via the timer. The part above case ALLEGRO_EVENT_DISPLAY_CLOSE: makes sure it can track whether keys were pressed anyway.
I tried to separate, as suggested, without much success. Unfortunately.
EDIT: Oh, now I got it!
I put this in separate, before the mouse event catcher, and it works!
Separate input and logic
The timer should control the logic only and not the input.