Console

At the moment I’m working on my console in the game. Now I want to be able to type commands etc. I entered my InputHandler and started writing some stuff, like outputting the name of the key. That pretty worked, but there’s only one problem. I need to be filtering keys out of it. What is the best way how I can do this?

Thanks for any help!

Use a switch:


char key = ....

switch(key) {
    case 'w': up(); break;
    case 'a': left(); break;
    case 's': down(); break:
    case 'd': right(); break;
}