本文整理汇总了C++中VRMenuObject::Init方法的典型用法代码示例。如果您正苦于以下问题:C++ VRMenuObject::Init方法的具体用法?C++ VRMenuObject::Init怎么用?C++ VRMenuObject::Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VRMenuObject
的用法示例。
在下文中一共展示了VRMenuObject::Init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateObject
//==================================
// VRMenuMgrLocal::CreateObject
// creates a new menu object
menuHandle_t VRMenuMgrLocal::CreateObject( VRMenuObjectParms const & parms )
{
if ( !Initialized )
{
LOG( "VRMenuMgrLocal::CreateObject - manager has not been initialized!" );
return menuHandle_t();
}
// validate parameters
if ( parms.Type >= VRMENU_MAX )
{
LOG( "VRMenuMgrLocal::CreateObject - Invalid menu object type: %i", parms.Type );
return menuHandle_t();
}
// create the handle first so we can enforce setting it be requiring it to be passed to the constructor
int index = -1;
if ( FreeList.GetSizeI() > 0 )
{
index = FreeList.Back();
FreeList.PopBack();
}
else
{
index = ObjectList.GetSizeI();
}
UInt32 id = ++CurrentId;
menuHandle_t handle = ComposeHandle( index, id );
//LOG( "VRMenuMgrLocal::CreateObject - handle is %llu", handle.Get() );
VRMenuObject * obj = new VRMenuObjectLocal( parms, handle );
if ( obj == NULL )
{
LOG( "VRMenuMgrLocal::CreateObject - failed to allocate menu object!" );
OVR_ASSERT( obj != NULL ); // this would be bad -- but we're likely just going to explode elsewhere
return menuHandle_t();
}
obj->Init( parms );
if ( index == ObjectList.GetSizeI() )
{
// we have to grow the array
ObjectList.PushBack( obj );
}
else
{
// insert in existing slot
OVR_ASSERT( ObjectList[index] == NULL );
ObjectList[index ] = obj;
}
return handle;
}