Reputation: 33
I am trying to make a text box in allegro and need a way of getting the ascii keycodes from the key presses. The ev.type == ALLEGRO_EVENT_KEY_DOWN
does not always work. I have tried getting the event to work faster but it is still slow.
If there is a way I could make this into a function that could give the Ascii char of what ever key is pressed, it would be great. (I have been looking but I cant find something easy and fast for the source code that I am using)
Upvotes: 2
Views: 371
Reputation: 8844
Perhaps you are looking for an ALLEGRO_EVENT_KEY_CHAR
event type. These events are generated every time a character is typed on the keyboard, or auto-repeated because the key was held down long enough. In other words, while ALLEGRO_EVENT_KEY_UP/DOWN
events correspond to the keyboard state, ALLEGRO_EVENT_KEY_CHAR
events correspond to the character input buffer state.
Upvotes: 4