Only function keys get caught by SDL_KEYDOWN and they get printed normally , normal letters and numbers sometimes get caught by SDL_TEXTINPUT(unpredictably) but when i try to print them i get either nothing or things like "Æëçó" , the key dosen't get caught at all by the if statement . Does anyone have the same problem ?
This is on win 10 Visual Studio 19 and i get the same results when using on screen keyboard .
switch (g_event->type)
{
case SDL_KEYDOWN: //here only ctrl , alt , caps get caught
std::cout << SDL_GetKeyName(g_event->key.keysym.sym); //this prints out the names correctly
break;
case SDL_TEXTINPUT: //here normal keys get caught sometimes(letters,numbers...)
std::cout << SDL_GetKeyName(g_event->key.keysym.sym); //this prints out things like this "ⁿÆëçó" or nothing at all
if(g_event->key.keysym.sym==SDLK_f) //the key isn't caught no matter what
{std::cout<<"f";}
break;
}
You would not access g_event.key.keysym.sym in a SDL_TEXTINPUT event. It gives you a parameter as g_event.text.text where you have the inputed text as a char array.