本文整理汇总了C++中Keyboard::AddCharacterToInputQueue方法的典型用法代码示例。如果您正苦于以下问题:C++ Keyboard::AddCharacterToInputQueue方法的具体用法?C++ Keyboard::AddCharacterToInputQueue怎么用?C++ Keyboard::AddCharacterToInputQueue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Keyboard
的用法示例。
在下文中一共展示了Keyboard::AddCharacterToInputQueue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WindowsMessageHandlingProcedure
//-----------------------------------------------------------------------------------------------
LRESULT CALLBACK WindowsMessageHandlingProcedure( HWND windowHandle, UINT wmMessageCode, WPARAM wParam, LPARAM lParam )
{
static const float ONE_OVER_WHEEL_DELTA = 1.f / WHEEL_DELTA;
unsigned char asKey = (unsigned char) wParam;
float normalizedMouseWheelDelta;
switch( wmMessageCode )
{
case WM_CLOSE:
case WM_DESTROY:
case WM_QUIT:
g_isQuitting = true;
return 0;
case WM_ACTIVATE:
if( wParam == WA_INACTIVE )
{
ShowCursor( true );
gameActive = false;
}
else
{
ShowCursor( false );
gameActive = true;
}
return 0;
case WM_CHAR:
switch( asKey )
{
case '`': //(Absorbed because it's the command console key)
case '~': //(Absorbed because it's the command console key)
case 0x0A: // Line Feed
case VK_BACK:
case VK_ESCAPE:
case VK_RETURN:
case VK_TAB:
return 0; //Do nothing with the special characters (handle these with regular input)
default:
g_keyboard.AddCharacterToInputQueue( asKey );
return 0;
}
case WM_KEYDOWN:
switch( asKey )
{
case VK_ESCAPE:
default:
g_keyboard.SetKeyDown( asKey );
return 0;
}
break;
case WM_KEYUP:
switch( asKey )
{
case VK_LBUTTON:
case VK_RBUTTON:
case VK_MBUTTON:
case VK_XBUTTON1:
case VK_XBUTTON2:
g_mouse.SetButtonUp( asKey );
return 0;
default:
g_keyboard.SetKeyUp( asKey );
return 0;
}
break;
case WM_LBUTTONDOWN:
g_mouse.SetButtonDown( VK_LBUTTON );
break;
case WM_LBUTTONUP:
g_mouse.SetButtonUp( VK_LBUTTON );
break;
case WM_RBUTTONDOWN:
g_mouse.SetButtonDown( VK_RBUTTON );
break;
case WM_RBUTTONUP:
g_mouse.SetButtonUp( VK_RBUTTON );
break;
case WM_MOUSEWHEEL:
normalizedMouseWheelDelta = static_cast< float >( GET_WHEEL_DELTA_WPARAM( wParam ) ) * ONE_OVER_WHEEL_DELTA;
g_mouse.SetWheelDelta( normalizedMouseWheelDelta );
break;
}
return DefWindowProc( windowHandle, wmMessageCode, wParam, lParam );
}