InpuText Input - SDL_KEYDOWN & Chinese Language

"maja" <[email protected]>
Newsgroups gmane.comp.lib.sdl
Message-ID <[email protected]>
I met what I think is a strange bug. I'm following a tutorial on SLD2, everything I write is extremely basic.

My computer is set to Tradiational Chinese with phnetic input by default, every time a new window is opend (as for example a consolle prompt) the user has either to push SHIFT or SHIFT+SPACEBAR to write latin characters.

I have this simple statement for writing text to my console, I also check SDL_KEYDOWN to get the backspaces:


Code:
if(ev.type == SDL_TEXTINPUT || ev.type == SDL_KEYDOWN) {
    system("cls");
    if(ev.type == SDL_KEYDOWN && ev.key.keysym.sym == SDLK_BACKSPACE && text.length() > 0) {
        text = text.substr(0, text.length() - 1);
    }
    else {
         text += ev.text.text;
    }
    std::cout << text << std::endl;
}


Adding ev.type == SDL_KEYDOWN to the code results in all characters being written as subscript of the following gibberish character: [Image: https://i.imgsafe.org/3d2a8d0f37.png ]

Most probably this has no influence at all on practical applications, still it's a curious thing.

_______________________________________________
SDL mailing list
[email protected]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.