当前位置: 首页>>代码示例>>C++>>正文


C++ VisBaseEntity_cl::GetObjectKey方法代码示例

本文整理汇总了C++中VisBaseEntity_cl::GetObjectKey方法的典型用法代码示例。如果您正苦于以下问题:C++ VisBaseEntity_cl::GetObjectKey方法的具体用法?C++ VisBaseEntity_cl::GetObjectKey怎么用?C++ VisBaseEntity_cl::GetObjectKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VisBaseEntity_cl的用法示例。


在下文中一共展示了VisBaseEntity_cl::GetObjectKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BuildCameraList

void VCameraHandling::BuildCameraList()
{
  VAppMenu* pMainMenu = GetParent()->GetAppModule<VAppMenu>();
  if (pMainMenu == NULL)
    return;

  int iActionIndex = 0;
  VAppMenuItems menuItems;
  menuItems.Add(VAppMenuItem("<Switch to Free Camera>", iActionIndex++, 0, false));

#if defined(WIN32) && !defined(_VISION_WINRT)
  // Add option to disable WASD controls.
  m_iWASDActionIndex = iActionIndex++;
  menuItems.Add(VAppMenuItem("<Toggle Free Camera WASD Controls>", m_iWASDActionIndex, 1, true, m_bWASDEnabled));
#endif

  // Find camera objects in the scene.
  // Only store element manager indices in order to be able to detect removed objects.
  unsigned int uiNumOrbitCameras = 0;
  unsigned int uiNumCameraPositions = 0;
  unsigned int uiNumPathCameras = 0;

  const unsigned int uiNumEntities = VisBaseEntity_cl::ElementManagerGetSize();
  for (unsigned int uiElementIndex = 0; uiElementIndex < uiNumEntities; uiElementIndex++)
  {
    VisBaseEntity_cl* pEntity = VisBaseEntity_cl::ElementManagerGet(uiElementIndex);
    if (pEntity == NULL)
      continue;

    // Try to convert the entity to all of the supported camera types.
    VOrbitCamera* pOrbitCamera = pEntity->Components().GetComponentOfBaseType<VOrbitCamera>();
    CameraPositionEntity* pCameraPosition = vdynamic_cast<CameraPositionEntity*>(pEntity);
    PathCameraEntity* pPathCamera = vdynamic_cast<PathCameraEntity*>(pEntity);

    // Menu name data 
    const char* szKey = "";
    const char* szCameraType = "";
    unsigned int uiSortingKey = 0;
    unsigned int uiCameraIndex = 0;

    if (pOrbitCamera != NULL)
    {
      // If the owner entity's key is not set, use the model's file name.
      const char* szKey = pEntity->GetObjectKey();
      if (VStringUtil::IsEmpty(szKey))
        szKey = (pEntity->GetMesh() ? pEntity->GetMesh()->GetFilename() : "");

      szCameraType = "OrbitCamera";
      uiSortingKey = 2;
      uiCameraIndex = uiNumOrbitCameras++;
    }
    else if (pCameraPosition != NULL)
    {
      szKey = pEntity->GetObjectKey();
      szCameraType = "CameraPosition";
      uiSortingKey = 3;
      uiCameraIndex = uiNumCameraPositions++;
    }
    else if (pPathCamera != NULL)
    {
      szKey = pEntity->GetObjectKey();
      szCameraType = "PathCamera";
      uiSortingKey = 4;
      uiCameraIndex = uiNumPathCameras++;
    }
    else
    {
      // If we haven't found a free camera entity yet, try to store this one.
      if (m_spFreeCamera == NULL)
        m_spFreeCamera = vdynamic_cast<VFreeCamera*>(pEntity);

      // No camera found.
      continue;
    }

    // Generate menu name.
    VString sMenuName;
    if (VStringUtil::IsEmpty(szKey))
      sMenuName.Format("%s%02d", szCameraType, uiCameraIndex + 1);
    else
      sMenuName.Format("%s%02d (%s)", szCameraType, uiCameraIndex + 1, szKey);

    menuItems.Add(VAppMenuItem(sMenuName, iActionIndex, uiSortingKey, false));
    m_actionMap.SetAt(iActionIndex++, EntityAccessor(pEntity, sMenuName));
  }

  m_callbacks.Append(pMainMenu->RegisterGroup(m_sMenuGroupName, menuItems, NULL, VAPP_DEFAULT_SORTING_2 + 1));
  RegisterCallbacks();
}
开发者ID:Superdenny,项目名称:peggle,代码行数:89,代码来源:VCameraHandling.cpp


注:本文中的VisBaseEntity_cl::GetObjectKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。