1
Feature requests / More Keys for Press/Release events
« on: March 24, 2008, 02:34:19 am »
yeah, but having it as hex numbers removes the need for drawing all those different characters ingame.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
int hiFlags = HIWORD(Flags);
if ( !(hiFlags & 0x100) ) {
switch( MapVirtualKey(hiFlags & 0xFF, 1) )
{
case VK_INSERT : return Key::Numpad0;
case VK_END : return Key::Numpad1;
case VK_DOWN : return Key::Numpad2;
case VK_NEXT : return Key::Numpad3;
case VK_LEFT : return Key::Numpad4;
case VK_CLEAR : return Key::Numpad5;
case VK_RIGHT : return Key::Numpad6;
case VK_HOME : return Key::Numpad7;
case VK_UP : return Key::Numpad8;
case VK_PRIOR : return Key::Numpad9;
case VK_DIVIDE: return Key::NumpadDivide;
case VK_MULTIPLY: return Key::NumpadMultiply;
case VK_SUBTRACT: return Key::NumpadSubtract;
case VK_ADD: return Key::NumpadAdd;
case VK_DELETE: return Key::NumpadDelete;
case VK_RETURN: return Key::NumpadReturn;
}
}
The system clock "ticks" at a constant rate. If dwMilliseconds is less than the resolution of the system clock, the thread may sleep for less than the specified length of time. If dwMilliseconds is greater than one tick but less than two, the wait can be anywhere between one and two ticks, and so on.
for( ; ((myIndex - JOYSTICKID1 <= Index) && (Error = joyGetPosEx(myIndex, &JoyInfo)) != JOYERR_PARMS; myIndex++ )
{
// Check if the current joystick is connected
if (Error == JOYERR_NOERROR)
{
....
}
}
void Joystick::Initialize(unsigned int Index)
{
// Reset state
myIndex = JOYSTICKID1;
myNbAxes = 0;
myNbButtons = 0;
// Get the Index-th connected joystick
MMRESULT Error;
JOYINFOEX JoyInfo;
for( int joysticksFound = 0; (Error = joyGetPosEx(myIndex, &JoyInfo)) != JOYERR_PARMS; myIndex++ )
{
// Check if the current joystick is connected
if (Error == JOYERR_NOERROR) {
if ( joysticksFound == Index ) {
// Store its caps
JOYCAPS Caps;
joyGetDevCaps(myIndex, &Caps, sizeof(Caps));
myNbAxes = Caps.wNumAxes;
myNbButtons = Caps.wNumButtons;
return;
}
joysticksFound++;
}
}
}