Char to keycode=not working?
Here's my code:
if(deli.length() == 1) {
char tmp1 = deli.charAt(0);
int tmp2 = tmp1;
system.out.println("The keycode for "+deli+" is: "+ Integer.toString(tmp2));
}else{
system.out.println("Invalid amount of characters.");
}
It gives me a keycode but, it's not what the right keycode, for instance, I need Z to be 44, but it gives me 90. I get the 44 from using LWJGL's Keyboard.KEY_Z variable.
I can't figure it out for the life of me.
Help?
NOTE* this is for a game mod, that why it has LWJGL.
Re: Char to keycode=not working?
Re: Char to keycode=not working?
The Java char type is an integral type. The integer value of 'Z' is 90.
If you need to get 44, just subtract 46.
db
Re: Char to keycode=not working?
I almost put it in there but, I decided not to, I tested with other characters, and the values are all different.
Re: Char to keycode=not working?
Upon further research, 44 is the linux keycode for Z, but I'm on windows, how would i convert the keycodes over?
Get linux keycodes from Char?
Keycode Table
I need those, for instance, Z is 44 there, but using conventional methods, I get 90, which is windows. Help? This is very urgent for me, no one on skype, or another forum can help me.
Re: Char to keycode=not working?
Please keep the discussion on this topic to this post, as opposed to starting another thread on the exact same topic. I've merged the threads