switch(message)
{
case WM_KEYDOWN:
{
if(keys[wParam] == FALSE)
{
keys[wParam] = TRUE;
KeyPress(wParam);
}
}break;
case WM_KEYUP:
{
keys[wParam] = FALSE;
}break;
}
/*******************************************/
void ERGUI::KeyPress(WPARAM Pressed)
{
switch(Pressed)
{
case 'a':
menejerim.AddButton(100,200,440,200,"hehhe",butonsprite,foo);
break;
case 'A':
menejerim.AddButton(300,200,440,200,"HEHHE",butonsprite,foo);
break;
}
}
Upper/Lowercase problem
Hi, after reading few writings about the lacks of dinput, I changed my inputsystem now it uses win32 messages, but wparam variable only holds uppercase letters, how do you get the 'right' case?
here is my code if this helps..
You want to use WM_CHAR for text, and WM_KEYDOWN for other keys. The wParam in a WM_CHAR message contains the character code.
Key presses are not the same as text. When the 'F' key is pressed, that could type either a lowercase f or an uppercase F... or it could open a 'find' dialog, or pop up the file menu, depending on the modifier keys. Meanwhile, if you hold the 'F' key down, it may continue to type more f's, although it hasn't been re-pressed.
the WM_CHAR messages are sent to indicate text that is typed. The WM_KEYDOWN messages are sent to indicate keys that have just been pushed down. If you want to get some text, use the WM_CHAR messages. If you want to treat 'a' and 'shift-a' like commands, then (a) you should probably make that 'ctrl-a' and 'shift-ctrl-a' instead; and (b) you will need to check for yourself what modifier keys are down. (You can, for example, have a flag for the shift key, that you set when you get a WM_KEYDOWN for shift, and clear when you get a WM_KEYUP for it.)
the WM_CHAR messages are sent to indicate text that is typed. The WM_KEYDOWN messages are sent to indicate keys that have just been pushed down. If you want to get some text, use the WM_CHAR messages. If you want to treat 'a' and 'shift-a' like commands, then (a) you should probably make that 'ctrl-a' and 'shift-ctrl-a' instead; and (b) you will need to check for yourself what modifier keys are down. (You can, for example, have a flag for the shift key, that you set when you get a WM_KEYDOWN for shift, and clear when you get a WM_KEYUP for it.)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement