It's been a while since I've used Glut for keyboard input handling, but I feel as though the keyboard callback function once provided an unmodified Key parameter - I might be remembering wrong.
In other words, pressing "r" returned a lowercase "r" character, while pressing SHIFT + "r" still returned a lowercase "r" and not an uppercase "R". This isn't the case now (perhaps it never was) as using a modifier key (SHIFT, CONTROL, ALT) actually modifies the key sent to the callback function. I've been trying to find a way to get the raw, unmodified value but have since had no luck.
Is there a way of accessing the unmodified keyboard value from the callback function, or will I need to find a way to reverse the modification manually in order to get the correct key value?
glutKeyboardFunc(keyDown);
...
void Game::keyDown(unsigned char key, int mouseX, int mouseY)
{
switch (key)
{
case 'r':
{
cout<<"Called when 'r' is pressed"<<endl;
cout<<"Is NOT called when SHIFT is the modifier"<<endl;
break;
}
case 'R':
{
cout<<"Called ONLY when 'r' is pressed with SHIFT"<<endl;
cout<<"Is NOT called when 'r' is pressed on its own"<<endl;
break;
}
case 18:
{
cout<<"Called ONLY when 'r' is pressed with CONTROL"<<endl;
cout<<"Is NOT called when 'r' is pressed on its own"<<endl;
break;
}
}
}
Any help or advice would be greatly appreciated.