本文整理汇总了C++中ControllerPtr::Layout方法的典型用法代码示例。如果您正苦于以下问题:C++ ControllerPtr::Layout方法的具体用法?C++ ControllerPtr::Layout怎么用?C++ ControllerPtr::Layout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ControllerPtr
的用法示例。
在下文中一共展示了ControllerPtr::Layout方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FeatureCount
unsigned int CAddonCallbacksPeripheral::FeatureCount(void* addonData, const char* controllerId, JOYSTICK_FEATURE_TYPE type)
{
using namespace ADDON;
using namespace GAME;
unsigned int count = 0;
AddonPtr addon;
if (CAddonMgr::GetInstance().GetAddon(controllerId, addon, ADDON_GAME_CONTROLLER))
{
ControllerPtr controller = std::static_pointer_cast<CController>(addon);
if (controller->LoadLayout())
count = controller->Layout().FeatureCount(CPeripheralAddonTranslator::TranslateFeatureType(type));
}
return count;
}
示例2: assert
CButtonMapping::CButtonMapping(IButtonMapper* buttonMapper, IButtonMap* buttonMap, IActionMap* actionMap) :
m_buttonMapper(buttonMapper),
m_buttonMap(buttonMap),
m_actionMap(actionMap),
m_lastAction(0),
m_frameCount(0)
{
assert(m_buttonMapper != nullptr);
assert(m_buttonMap != nullptr);
// Make sure axes mapped to Select are centered before they can be mapped.
// This ensures that they are not immediately mapped to the first button.
if (m_actionMap && m_actionMap->ControllerID() == m_buttonMap->ControllerID())
{
using namespace GAME;
CGameServices& gameServices = CServiceBroker::GetGameServices();
ControllerPtr controller = gameServices.GetController(m_actionMap->ControllerID());
const auto& features = controller->Layout().Features();
for (const auto& feature : features)
{
if (m_actionMap->GetActionID(feature.Name()) != ACTION_SELECT_ITEM)
continue;
CDriverPrimitive primitive;
if (!m_buttonMap->GetScalar(feature.Name(), primitive))
continue;
if (primitive.Type() != PRIMITIVE_TYPE::SEMIAXIS)
continue;
// Set initial config, as detection will fail because axis is already activated
AxisConfiguration axisConfig;
axisConfig.bKnown = true;
axisConfig.center = primitive.Center();
axisConfig.range = primitive.Range();
GetAxis(primitive.Index(), primitive.Center(), axisConfig).SetEmitted(primitive);
}
}
}
示例3: Load
void CGUIFeatureList::Load(const ControllerPtr& controller)
{
if (m_controller && m_controller->ID() == controller->ID())
return; // Already loaded
CleanupButtons();
m_controller = controller;
const std::vector<CControllerFeature>& features = controller->Layout().Features();
for (unsigned int buttonIndex = 0; buttonIndex < features.size(); buttonIndex++)
{
const CControllerFeature& feature = features[buttonIndex];
CGUIButtonControl* pButton = nullptr;
switch (feature.Type())
{
case JOYSTICK::FEATURE_TYPE::SCALAR:
{
pButton = new CGUIScalarFeatureButton(*m_guiButtonTemplate, m_wizard, feature, buttonIndex);
break;
}
case JOYSTICK::FEATURE_TYPE::ANALOG_STICK:
{
pButton = new CGUIAnalogStickButton(*m_guiButtonTemplate, m_wizard, feature, buttonIndex);
break;
}
default:
break;
}
if (pButton)
m_guiList->AddControl(pButton);
// Just in case
if (buttonIndex >= MAX_FEATURE_COUNT)
break;
}
}