コード例 #1
0
//==============================
// FindTargetPath
static void FindTargetPath( OvrGuiSys & guiSys, menuHandle_t const rootHandle, 
        menuHandle_t const curHandle, Array< menuHandle_t > & targetPath ) 
{
	FindTargetPath( guiSys, curHandle, targetPath );
	if ( targetPath.GetSizeI() == 0 )
	{
		targetPath.PushBack( rootHandle );   // ensure at least root is in the path
	}
}
コード例 #2
0
//==============================
// VRMenuEventHandler::HandleEvents
void VRMenuEventHandler::HandleEvents( OvrGuiSys & guiSys, VrFrame const & vrFrame, 
		menuHandle_t const rootHandle, Array< VRMenuEvent > const & events ) const
{
	VRMenuObject * root = guiSys.GetVRMenuMgr().ToObject( rootHandle );
	if ( root == NULL )
	{
		return;
	}

	// find the list of all objects that are in the focused path
	Array< menuHandle_t > focusPath;
	FindTargetPath( guiSys, rootHandle, FocusedHandle, focusPath );
    
	Array< menuHandle_t > targetPath;

	for ( int i = 0; i < events.GetSizeI(); ++i )
	{
		VRMenuEvent const & event = events[i];
		switch ( event.DispatchType )
		{
			case EVENT_DISPATCH_BROADCAST:
			{
				// broadcast to everything
				BroadcastEvent( guiSys, vrFrame, event, root );
			}
			break;
			case EVENT_DISPATCH_FOCUS:
				// send to the focus path only -- this list should be parent -> child order
				DispatchToPath( guiSys, vrFrame, event, focusPath, false );
				break;
			case EVENT_DISPATCH_TARGET:
				if ( targetPath.GetSizeI() == 0 || event.TargetHandle != targetPath.Back() )
				{
					targetPath.Clear();
					FindTargetPath( guiSys, rootHandle, event.TargetHandle, targetPath );
				}
				DispatchToPath( guiSys, vrFrame, event, targetPath, false );
				break;
			default:
				OVR_ASSERT( !"unknown dispatch type" );
				break;
		}
	}
}
コード例 #3
0
//==============================
// 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 );
	}
}
コード例 #4
0
//==============================
// 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 );
    }
}