本文整理汇总了C++中GHOST_SystemWin32::getModifierKeys方法的典型用法代码示例。如果您正苦于以下问题:C++ GHOST_SystemWin32::getModifierKeys方法的具体用法?C++ GHOST_SystemWin32::getModifierKeys怎么用?C++ GHOST_SystemWin32::getModifierKeys使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GHOST_SystemWin32
的用法示例。
在下文中一共展示了GHOST_SystemWin32::getModifierKeys方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
GHOST_TKey GHOST_SystemWin32::convertKey(GHOST_IWindow *window, WPARAM wParam, LPARAM lParam) const
{
GHOST_SystemWin32 *system = (GHOST_SystemWin32 *)getSystem();
bool isExtended = (lParam&(1<<24))?true:false;
GHOST_TKey key;
GHOST_ModifierKeys oldModifiers, newModifiers;
system->retrieveModifierKeys(oldModifiers);
system->getModifierKeys(newModifiers);
//std::cout << wParam << " " << system->m_curKeyStatus[wParam] << " shift pressed: " << system->shiftPressed() << std::endl;
if ((wParam >= '0') && (wParam <= '9')) {
// VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39)
key = (GHOST_TKey)(wParam - '0' + GHOST_kKey0);
}
else if ((wParam >= 'A') && (wParam <= 'Z')) {
// VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A)
key = (GHOST_TKey)(wParam - 'A' + GHOST_kKeyA);
}
else if ((wParam >= VK_F1) && (wParam <= VK_F24)) {
key = (GHOST_TKey)(wParam - VK_F1 + GHOST_kKeyF1);
}
else {
switch (wParam) {
case VK_RETURN:
key = isExtended?GHOST_kKeyNumpadEnter:GHOST_kKeyEnter;
break;
case VK_BACK: key = GHOST_kKeyBackSpace; break;
case VK_TAB: key = GHOST_kKeyTab; break;
case VK_ESCAPE: key = GHOST_kKeyEsc; break;
case VK_SPACE: key = GHOST_kKeySpace; break;
case VK_PRIOR: key = GHOST_kKeyUpPage; break;
case VK_NEXT: key = GHOST_kKeyDownPage; break;
case VK_END: key = GHOST_kKeyEnd; break;
case VK_HOME:
{
if(system->m_curKeyStatus[VK_NUMPAD7] && system->shiftPressed())
key = GHOST_kKeyNumpad7;
else
key = GHOST_kKeyHome;
}
break;
case VK_INSERT: key = GHOST_kKeyInsert; break;
case VK_DELETE: key = GHOST_kKeyDelete; break;
case VK_LEFT: key = GHOST_kKeyLeftArrow; break;
case VK_RIGHT: key = GHOST_kKeyRightArrow; break;
case VK_UP: key = GHOST_kKeyUpArrow; break;
case VK_DOWN: key = GHOST_kKeyDownArrow; break;
case VK_NUMPAD0: key = GHOST_kKeyNumpad0; break;
case VK_NUMPAD1: key = GHOST_kKeyNumpad1; break;
case VK_NUMPAD2: key = GHOST_kKeyNumpad2; break;
case VK_NUMPAD3: key = GHOST_kKeyNumpad3; break;
case VK_NUMPAD4: key = GHOST_kKeyNumpad4; break;
case VK_NUMPAD5: key = GHOST_kKeyNumpad5; break;
case VK_NUMPAD6: key = GHOST_kKeyNumpad6; break;
case VK_NUMPAD7: key = GHOST_kKeyNumpad7; break;
case VK_NUMPAD8: key = GHOST_kKeyNumpad8; break;
case VK_NUMPAD9: key = GHOST_kKeyNumpad9; break;
case VK_SNAPSHOT: key = GHOST_kKeyPrintScreen; break;
case VK_PAUSE: key = GHOST_kKeyPause; break;
case VK_MULTIPLY: key = GHOST_kKeyNumpadAsterisk; break;
case VK_SUBTRACT: key = GHOST_kKeyNumpadMinus; break;
case VK_DECIMAL: key = GHOST_kKeyNumpadPeriod; break;
case VK_DIVIDE: key = GHOST_kKeyNumpadSlash; break;
case VK_ADD: key = GHOST_kKeyNumpadPlus; break;
case VK_SEMICOLON: key = GHOST_kKeySemicolon; break;
case VK_EQUALS: key = GHOST_kKeyEqual; break;
case VK_COMMA: key = GHOST_kKeyComma; break;
case VK_MINUS: key = GHOST_kKeyMinus; break;
case VK_PERIOD: key = GHOST_kKeyPeriod; break;
case VK_SLASH: key = GHOST_kKeySlash; break;
case VK_BACK_QUOTE: key = GHOST_kKeyAccentGrave; break;
case VK_OPEN_BRACKET: key = GHOST_kKeyLeftBracket; break;
case VK_BACK_SLASH: key = GHOST_kKeyBackslash; break;
case VK_CLOSE_BRACKET: key = GHOST_kKeyRightBracket; break;
case VK_QUOTE: key = GHOST_kKeyQuote; break;
case VK_GR_LESS: key = GHOST_kKeyGrLess; break;
case VK_SHIFT:
{
bool lchanged = oldModifiers.get(GHOST_kModifierKeyLeftShift) != newModifiers.get(GHOST_kModifierKeyLeftShift);
if(lchanged) {
key = GHOST_kKeyLeftShift;
} else {
bool rchanged = oldModifiers.get(GHOST_kModifierKeyRightShift) != newModifiers.get(GHOST_kModifierKeyRightShift);
if(rchanged) {
key = GHOST_kKeyRightShift;
} else {
key = GHOST_kKeyUnknown;
}
}
}
break;
case VK_CONTROL:
{
bool lchanged = oldModifiers.get(GHOST_kModifierKeyLeftControl) != newModifiers.get(GHOST_kModifierKeyLeftControl);
if(lchanged) {
//.........这里部分代码省略.........