本文整理汇总了C++中VRMenuObject::AddComponent方法的典型用法代码示例。如果您正苦于以下问题:C++ VRMenuObject::AddComponent方法的具体用法?C++ VRMenuObject::AddComponent怎么用?C++ VRMenuObject::AddComponent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VRMenuObject
的用法示例。
在下文中一共展示了VRMenuObject::AddComponent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddCells
void UIDiscreteSlider::AddCells( unsigned int maxValue, unsigned int startValue, float cellSpacing )
{
MaxValue = maxValue;
StartValue = startValue;
DiscreteSliderComponent = new UIDiscreteSliderComponent( *this, StartValue );
OVR_ASSERT( DiscreteSliderComponent );
AddComponent( DiscreteSliderComponent );
float cellOffset = 0.0f;
const float pixelCellSpacing = cellSpacing * VRMenuObject::DEFAULT_TEXEL_SCALE;
VRMenuFontParms fontParms( HORIZONTAL_CENTER, VERTICAL_CENTER, false, false, false, 1.0f );
Vector3f defaultScale( 1.0f );
for ( unsigned int cellIndex = 0; cellIndex <= MaxValue; ++cellIndex )
{
const Posef pose( Quatf( Vector3f( 0.0f, 1.0f, 0.0f ), 0.0f ),
Vector3f( cellOffset, 0.f, 0.0f ) );
cellOffset += pixelCellSpacing;
VRMenuObjectParms cellParms( VRMENU_BUTTON, Array< VRMenuComponent* >(), VRMenuSurfaceParms(),
"", pose, defaultScale, fontParms, Menu->AllocId(),
VRMenuObjectFlags_t(), VRMenuObjectInitFlags_t( VRMENUOBJECT_INIT_FORCE_POSITION ) );
UICell * cellObject = new UICell( GuiSys );
cellObject->AddToDiscreteSlider( Menu, this, cellParms );
cellObject->SetImage( 0, SURFACE_TEXTURE_DIFFUSE, CellOffTexture );
UICellComponent * cellComp = new UICellComponent( *DiscreteSliderComponent, cellIndex );
VRMenuObject * object = cellObject->GetMenuObject();
OVR_ASSERT( object );
object->AddComponent( cellComp );
DiscreteSliderComponent->AddCell( cellObject );
}
DiscreteSliderComponent->HighlightCells( StartValue );
}