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


C++ VRMenuObject类代码示例

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


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

示例1: GetMenuObject

void UILabel::SetText( const char *text )
{
	VRMenuObject * object = GetMenuObject();
	assert( object );
	object->SetText( text );
	CalculateTextOffset();
}
开发者ID:8BitRick,项目名称:GearVRNative,代码行数:7,代码来源:UILabel.cpp

示例2: DecomposeHandle

//==================================
// VRMenuMgrLocal::ToObject
// Return the object for a menu handle.
VRMenuObject * VRMenuMgrLocal::ToObject( menuHandle_t const handle ) const
{
	int index;
	UInt32 id;
	DecomposeHandle( handle, index, id );
	if ( id == INVALID_MENU_OBJECT_ID )
	{
		return NULL;
	}
	if ( !HandleComponentsAreValid( index, id ) )
	{
		LOG( "VRMenuMgrLocal::ToObject - invalid handle." );
		return NULL;
	}
	if ( index >= ObjectList.GetSizeI() )
	{
		LOG( "VRMenuMgrLocal::ToObject - index out of range." );
		return NULL;
	}
	VRMenuObject * object = ObjectList[index];
	if ( object == NULL )
	{
		LOG( "VRMenuMgrLocal::ToObject - slot empty." );
		return NULL;	// this can happen if someone is holding onto the handle of an object that's been freed
	}
	if ( object->GetHandle() != handle )
	{
		// if the handle of the object in the slot does not match, then the object the handle refers to was deleted
		// and a new object is in the slot
		LOG( "VRMenuMgrLocal::ToObject - slot mismatch." );
		return NULL;
	}
	return object;
}
开发者ID:beijingkaka,项目名称:shellspace,代码行数:37,代码来源:VRMenuMgr.cpp

示例3: DispatchToPath

//==============================
// VRMenuEventHandler::DispatchToPath
bool VRMenuEventHandler::DispatchToPath( OvrGuiSys & guiSys, VrFrame const & vrFrame, 
        VRMenuEvent const & event, Array< menuHandle_t > const & path, bool const log ) const
{
	// send to the focus path only -- this list should be parent -> child order
	for ( int i = 0; i < path.GetSizeI(); ++i )
	{
		VRMenuObject * obj = guiSys.GetVRMenuMgr().ToObject( path[i] );
		char const * const indent = "                                                                ";
		// set to 
		if ( obj != NULL && DispatchToComponents( guiSys, vrFrame, event, obj ) )
		{
			if ( log )
			{
				LOG( "%sDispatchToPath: %s, object '%s' consumed event.", &indent[64 - i * 2],
						VRMenuEvent::EventTypeNames[event.EventType], ( obj != NULL ? obj->GetText().ToCStr() : "<null>" ) );
			}	
			return true;    // consumed by a component
		}
		if ( log )
		{
			LOG( "%sDispatchToPath: %s, object '%s' passed event.", &indent[64 - i * 2],
					VRMenuEvent::EventTypeNames[event.EventType], obj != NULL ? obj->GetText().ToCStr() : "<null>" );
		}
	}
	return false;
}
开发者ID:8BitRick,项目名称:GearVRNative,代码行数:28,代码来源:VRMenuEventHandler.cpp

示例4: OVR_UNUSED

//==============================
// OvrSliderComponent::SetCaretPoseFromFrac
void OvrSliderComponent::SetCaretPoseFromFrac( OvrVRMenuMgr & menuMgr, VRMenuObject * self, float const frac )
{
	OVR_UNUSED( frac );

	VRMenuObject * caret = menuMgr.ToObject( self->ChildHandleForId( menuMgr, ScrubberId ) );
	if ( caret != NULL )
	{
		Posef curPose = CaretBasePose;
		float range = MaxValue - MinValue;
		float frac = floor( SliderFrac * range ) / range;
		curPose.Position += ( LocalSlideDelta * -0.5f ) + LocalSlideDelta * frac;
		caret->SetLocalPose( curPose );
	}

	// find the fill object and scale it
	menuHandle_t fillHandle = Menu.HandleForId( menuMgr, FillId );
	VRMenuObject * fillObj = menuMgr.ToObject( fillHandle );
	if ( fillObj != NULL )
	{
		Vector4f clipUVs( 0.0f, 1.0f - SliderFrac, 1.0f, 1.0f );
		VRMenuSurface & surf = fillObj->GetSurface( 0 );
		surf.SetClipUVs( clipUVs );
		//LOG( "SliderFrac = %.2f", SliderFrac );
		//LOG( "Setting clip UVs to ( %.2f, %.2f, %.2f, %.2f )", clipUVs.x, clipUVs.y, clipUVs.z, clipUVs.w );
	}	
}
开发者ID:8BitRick,项目名称:GearVRNative,代码行数:28,代码来源:SliderComponent.cpp

示例5: UpdateText

//==============================
// OvrSliderComponent::OnFrameUpdate
eMsgStatus OvrSliderComponent::OnFrameUpdate( App * app, VrFrame const & vrFrame, OvrVRMenuMgr & menuMgr, 
		VRMenuObject * self, VRMenuEvent const & event )
{
	if ( TouchDown )
	{
		UpdateText( menuMgr, self, BubbleId );
		UpdateText( menuMgr, self, TextId );
	}

	if ( BubbleFadeOutTime > 0.0 )
	{
		if ( ovr_GetTimeInSeconds() >= BubbleFadeOutTime )
		{
			BubbleFadeOutTime = -1.0;
			BubbleFader.StartFadeOut();
		}
	}

	VRMenuObject * bubble = menuMgr.ToObject( self->ChildHandleForId( menuMgr, BubbleId ) );
	if ( bubble != NULL )
	{
		float const fadeTime = 0.5f;
		float const fadeRate = 1.0 / fadeTime;
		BubbleFader.Update( fadeRate, vrFrame.DeltaSeconds );

		Vector4f color = bubble->GetColor();
		color.w = BubbleFader.GetFinalAlpha();
		bubble->SetColor( color );
		Vector4f textColor = bubble->GetTextColor();
		textColor.w = color.w;
		bubble->SetTextColor( textColor );
	}

	return MSG_STATUS_ALIVE;
}
开发者ID:1107979819,项目名称:OculusVRStudy,代码行数:37,代码来源:SliderComponent.cpp

示例6: SetBaseColor

void OvrScrollBarComponent::SetBaseColor( OvrVRMenuMgr & menuMgr, VRMenuObject * self, const Vector4f & color )
{
	// Set alpha on the base - move this to somewhere more explicit if needed
	VRMenuObject * base = menuMgr.ToObject( self->ChildHandleForId( menuMgr, ScrollBarBaseId ) );
	if ( base != NULL )
	{
		base->SetSurfaceColor( 0, color );
	}
}
开发者ID:8BitRick,项目名称:GearVRNative,代码行数:9,代码来源:ScrollBarComponent.cpp

示例7: SetPosition

void ResumeMovieView::SetPosition( OvrVRMenuMgr & menuMgr, const Vector3f &pos )
{
    menuHandle_t centerRootHandle = Menu->HandleForId( menuMgr, ID_CENTER_ROOT );
    VRMenuObject * centerRoot = menuMgr.ToObject( centerRootHandle );
    OVR_ASSERT( centerRoot != NULL );

    Posef pose = centerRoot->GetLocalPose();
    pose.Position = pos;
    centerRoot->SetLocalPose( pose );
}
开发者ID:1107979819,项目名称:OculusVRStudy,代码行数:10,代码来源:ResumeMovieView.cpp

示例8: FindTargetPath

//==============================
// FindTargetPath
static void FindTargetPath( OvrGuiSys & guiSys, 
        menuHandle_t const curHandle, Array< menuHandle_t > & targetPath ) 
{
	VRMenuObject * obj = guiSys.GetVRMenuMgr().ToObject( curHandle );
	if ( obj != NULL )
	{
		FindTargetPath( guiSys, obj->GetParentHandle(), targetPath );
		targetPath.PushBack( curHandle );
	}
}
开发者ID:8BitRick,项目名称:GearVRNative,代码行数:12,代码来源:VRMenuEventHandler.cpp

示例9: FindTargetPath

//==============================
// FindTargetPath
static void FindTargetPath( OvrVRMenuMgr const & menuMgr,
                            menuHandle_t const curHandle, Array< menuHandle_t > & targetPath )
{
    VRMenuObject * obj = menuMgr.ToObject( curHandle );
    if ( obj != NULL )
    {
        FindTargetPath( menuMgr, obj->GetParentHandle(), targetPath );
        targetPath.PushBack( curHandle );
    }
}
开发者ID:colwalder,项目名称:unrealengine,代码行数:12,代码来源:VRMenuEventHandler.cpp

示例10: LOG

//==================================
// 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;
}
开发者ID:beijingkaka,项目名称:shellspace,代码行数:58,代码来源:VRMenuMgr.cpp

示例11: SetCaretPoseFromFrac

//==============================
// OvrSliderComponent::SetCaretPoseFromFrac
void OvrSliderComponent::SetCaretPoseFromFrac( OvrVRMenuMgr & menuMgr, VRMenuObject * self, float const frac )
{
	VRMenuObject * caret = menuMgr.ToObject( self->ChildHandleForId( menuMgr, ScrubberId ) );
	if ( caret != NULL )
	{
		Posef curPose = CaretBasePose;
		float range = MaxValue - MinValue;
		float frac = floor( SliderFrac * range ) / range;
		curPose.Position += ( LocalSlideDelta * -0.5f ) + LocalSlideDelta * frac;
		caret->SetLocalPose( curPose );
	}
}
开发者ID:1107979819,项目名称:OculusVRStudy,代码行数:14,代码来源:SliderComponent.cpp

示例12: LOG

//==============================
// OvrSliderComponent::OnInit
eMsgStatus OvrSliderComponent::OnInit( App * app, VrFrame const & vrFrame, OvrVRMenuMgr & menuMgr, 
		VRMenuObject * self, VRMenuEvent const & event )
{
	// find the starting offset of the caret
	LOG( "OvrSliderComponent - VRMENU_EVENT_INIT" );
	VRMenuObject * caret = menuMgr.ToObject( self->ChildHandleForId( menuMgr, ScrubberId ) );
	if ( caret != NULL )
	{
		CaretBasePose = caret->GetLocalPose();
	}
	SetCaretPoseFromFrac( menuMgr, self, SliderFrac );
	UpdateText( menuMgr, self, BubbleId );
	return MSG_STATUS_ALIVE;
}
开发者ID:1107979819,项目名称:OculusVRStudy,代码行数:16,代码来源:SliderComponent.cpp

示例13: UIDiscreteSliderComponent

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 );
}
开发者ID:8BitRick,项目名称:GearVRNative,代码行数:40,代码来源:UIDiscreteSlider.cpp

示例14: OVR_ASSERT

void OvrPanoMenu::UpdateButtonsState( const OvrMetaDatum * const ActivePano, bool showSwipeOverride /*= false*/ )
{
	// Reset button time
	ButtonCoolDown = BUTTON_COOL_DOWN_SECONDS;

	// Update favo
	bool isFavorite = false;

	for ( int i = 0; i < ActivePano->Tags.GetSizeI( ); ++i )
	{
		if ( ActivePano->Tags[ i ] == "Favorites" )
		{
			isFavorite = true;
			break;
		}
	}

	VRMenuObject * favoritesButtonObject = MenuMgr.ToObject( FavoritesButtonHandle );
	OVR_ASSERT( favoritesButtonObject != NULL );

	if ( OvrSurfaceToggleComponent * favToggleComp = favoritesButtonObject->GetComponentByName<OvrSurfaceToggleComponent>() )
	{
		const int fav = isFavorite ? 2 : 0;
		favToggleComp->SetGroupIndex( fav );
	}

	VRMenuObject * swipeRight = MenuMgr.ToObject( SwipeRightIndicatorHandle );
	OVR_ASSERT( swipeRight != NULL );

	VRMenuObject * swipeLeft = MenuMgr.ToObject( SwipeLeftIndicatorHandle );
	OVR_ASSERT( swipeLeft != NULL );

	const bool showSwipeIndicators = showSwipeOverride || ( Photos->GetNumPanosInActiveCategory( ) > 1 );

	VRMenuObjectFlags_t flagsLeft = swipeRight->GetFlags( );
	VRMenuObjectFlags_t flagsRight = swipeRight->GetFlags( );

	if ( showSwipeIndicators )
	{
		flagsLeft &= ~VRMenuObjectFlags_t( VRMENUOBJECT_DONT_RENDER );
		flagsRight &= ~VRMenuObjectFlags_t( VRMENUOBJECT_DONT_RENDER );
	}
	else
	{
		flagsLeft |= VRMenuObjectFlags_t( VRMENUOBJECT_DONT_RENDER );
		flagsRight |= VRMenuObjectFlags_t( VRMENUOBJECT_DONT_RENDER );
	}

	swipeLeft->SetFlags( flagsLeft );
	swipeRight->SetFlags( flagsRight );
}
开发者ID:rshi-google,项目名称:test,代码行数:51,代码来源:PanoMenu.cpp

示例15: Vector2f

void OvrScrollBarComponent::UpdateScrollBar( OvrVRMenuMgr & menuMgr, VRMenuObject * self, const int numElements )
{
	NumOfItems = numElements;

	if ( IsVertical )
	{
		ScrollBarCurrentbaseLength = ScrollBarBaseHeight;
	}
	else
	{
		ScrollBarCurrentbaseLength = ScrollBarBaseWidth;
	}

	ScrollBarCurrentThumbLength = ScrollBarCurrentbaseLength / NumOfItems;
	ScrollBarCurrentThumbLength =  ( ScrollBarCurrentThumbLength < BASE_THUMB_WIDTH ) ? BASE_THUMB_WIDTH : ScrollBarCurrentThumbLength;

	if ( IsVertical )
	{
		ScrollBarThumbHeight = ScrollBarCurrentThumbLength;
	}
	else
	{
		ScrollBarThumbWidth = ScrollBarCurrentThumbLength;
	}

	VRMenuObject * thumb = menuMgr.ToObject( self->ChildHandleForId( menuMgr, ScrollBarThumbId ) );
	if ( thumb != NULL && NumOfItems > 0 )
	{
		thumb->SetSurfaceDims( 0, Vector2f( ScrollBarThumbWidth, ScrollBarThumbHeight ) );
		thumb->RegenerateSurfaceGeometry( 0, false );
	}

	VRMenuObject * base = menuMgr.ToObject( self->ChildHandleForId( menuMgr, ScrollBarBaseId ) );
	if ( thumb != NULL )
	{
		base->SetSurfaceDims( 0, Vector2f( ScrollBarBaseWidth, ScrollBarBaseHeight ) );
		base->RegenerateSurfaceGeometry( 0, false );
	}
}
开发者ID:8BitRick,项目名称:GearVRNative,代码行数:39,代码来源:ScrollBarComponent.cpp


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