本文整理汇总了C++中CAction::IsAnalog方法的典型用法代码示例。如果您正苦于以下问题:C++ CAction::IsAnalog方法的具体用法?C++ CAction::IsAnalog怎么用?C++ CAction::IsAnalog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAction
的用法示例。
在下文中一共展示了CAction::IsAnalog方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QueueAction
void CInputManager::QueueAction(const CAction& action)
{
CSingleLock lock(m_actionMutex);
// Avoid dispatching multiple analog actions per frame with the same ID
if (action.IsAnalog())
{
m_queuedActions.erase(std::remove_if(m_queuedActions.begin(), m_queuedActions.end(),
[&action](const CAction& queuedAction)
{
return action.GetID() == queuedAction.GetID();
}), m_queuedActions.end());
}
m_queuedActions.push_back(action);
}
示例2: OnAction
bool CInputManager::OnAction(const CAction& action)
{
if (action.GetID() != ACTION_NONE)
{
if (action.IsAnalog())
{
QueueAction(action);
}
else
{
// If button was pressed this frame, send action
if (action.GetHoldTime() == 0)
{
QueueAction(action);
}
else
{
// Only send repeated actions for basic navigation commands
bool bIsNavigation = false;
switch (action.GetID())
{
case ACTION_MOVE_LEFT:
case ACTION_MOVE_RIGHT:
case ACTION_MOVE_UP:
case ACTION_MOVE_DOWN:
case ACTION_PAGE_UP:
case ACTION_PAGE_DOWN:
bIsNavigation = true;
break;
default:
break;
}
if (bIsNavigation)
QueueAction(action);
}
}
return true;
}
return false;
}