[SDL 1.3] text input

Hi all,

I’m now using this to get text from a text input event:

for (int i = 0; i != SDL_TEXTINPUTEVENT_TEXT_SIZE; ++i) {
if (sdle.text.text[i] == ‘\0’) {
break;
}
if ((sdle.text.text[i] & 0xFF80) == 0) {
char ch = sdle.text.text[i] & 0x7F;
if (ch >= 32 && ch < 127) {
chars += ch;
}
}
}

Does that look reasonable?

I seem to have a problem with key down events though: I get an event for the
delete key being pressed (with the delete scancode), but the sym variable is
0 instead of SDLK_DELETE. Is this meant to be the case?

Cheers,

nh

The delete key not working would appear to be because of line 146 in
SDL_keysym.h, where SDLK_DELETE is defined as “\177”. Changing it to
SDLK_DELETE = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DELETE), like the others
seems to work. Is there a reason this is different?

nhOn 12 June 2010 12:17, Nether Hound <@Nether_Hound> wrote:

Hi all,

I’m now using this to get text from a text input event:

for (int i = 0; i != SDL_TEXTINPUTEVENT_TEXT_SIZE; ++i) {
if (sdle.text.text[i] == ‘\0’) {
break;
}
if ((sdle.text.text[i] & 0xFF80) == 0) {
char ch = sdle.text.text[i] & 0x7F;
if (ch >= 32 && ch < 127) {
chars += ch;
}
}
}

Does that look reasonable?

I seem to have a problem with key down events though: I get an event for
the delete key being pressed (with the delete scancode), but the sym
variable is 0 instead of SDLK_DELETE. Is this meant to be the case?

Cheers,

nh