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


C++ VRMenuObject::GetFlags方法代码示例

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


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

示例1: UpdateButtonsState

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

示例2: Frame

//==============================
// VRMenuEventHandler::Frame
void VRMenuEventHandler::Frame( OvrGuiSys & guiSys, VrFrame const & vrFrame, 
        menuHandle_t const & rootHandle, Posef const & menuPose, Array< VRMenuEvent > & events )
{
	VRMenuObject * root = guiSys.GetVRMenuMgr().ToObject( rootHandle );
	if ( root == NULL )
	{
		return;
	}

	// find the object the gaze is touching and update gaze focus
	const Matrix4f viewMatrix = guiSys.GetApp()->GetLastViewMatrix();
	const Vector3f viewPos( GetViewMatrixPosition( viewMatrix ) );
	const Vector3f viewFwd( GetViewMatrixForward( viewMatrix ) );

	HitTestResult result;
	menuHandle_t hitHandle = root->HitTest( guiSys, menuPose, viewPos, viewFwd, ContentFlags_t( CONTENT_SOLID ), result );
	result.RayStart = viewPos;
	result.RayDir = viewFwd;

	VRMenuObject * hit = hitHandle.IsValid() ? guiSys.GetVRMenuMgr().ToObject( hitHandle ) : NULL;
/*
	if ( hit != NULL )
	{
		guiSys.GetApp()->ShowInfoText( 0.0f, "%s", hit->GetText().ToCStr() );
	}
*/
	bool focusChanged = ( hitHandle != FocusedHandle );
	if ( focusChanged )
	{
		// focus changed
		VRMenuObject * oldFocus = guiSys.GetVRMenuMgr().ToObject( FocusedHandle );
		if ( oldFocus != NULL )
		{
			// setup event for item losing the focus
			VRMenuEvent event( VRMENU_EVENT_FOCUS_LOST, EVENT_DISPATCH_TARGET, FocusedHandle, Vector3f( 0.0f ), result );
			events.PushBack( event );
		}
		if ( hit != NULL )
		{
			if ( ( hit->GetFlags() & VRMENUOBJECT_FLAG_NO_FOCUS_GAINED ) == 0 )
			{
				// set up event for item gaining the focus
				VRMenuEvent event( VRMENU_EVENT_FOCUS_GAINED, EVENT_DISPATCH_FOCUS, hitHandle, Vector3f( 0.0f ), result );
				events.PushBack( event );
			}
		}
		FocusedHandle = hitHandle;
	}

	if ( ( vrFrame.Input.buttonPressed & BUTTON_SWIPE_UP ) != 0 )
	{
		VRMenuEvent event( VRMENU_EVENT_SWIPE_UP, EVENT_DISPATCH_FOCUS, FocusedHandle, Vector3f( 0.0f ), result );
		events.PushBack( event );
	}
	if ( ( vrFrame.Input.buttonPressed & BUTTON_SWIPE_DOWN ) != 0 )
	{
		VRMenuEvent event( VRMENU_EVENT_SWIPE_DOWN, EVENT_DISPATCH_FOCUS, FocusedHandle, Vector3f( 0.0f ), result );
		events.PushBack( event );

	}
	if ( ( vrFrame.Input.buttonPressed & BUTTON_SWIPE_FORWARD ) != 0 )
	{
		VRMenuEvent event( VRMENU_EVENT_SWIPE_FORWARD, EVENT_DISPATCH_FOCUS, FocusedHandle, Vector3f( 0.0f ), result );
		events.PushBack( event );

	}
	if ( ( vrFrame.Input.buttonPressed & BUTTON_SWIPE_BACK ) != 0 )
	{
		VRMenuEvent event( VRMENU_EVENT_SWIPE_BACK, EVENT_DISPATCH_FOCUS, FocusedHandle, Vector3f( 0.0f ), result );
		events.PushBack( event );
	}

	bool touchPressed = ( vrFrame.Input.buttonPressed & ( BUTTON_TOUCH | BUTTON_A ) ) != 0;
	bool touchReleased = !touchPressed && ( vrFrame.Input.buttonReleased & ( BUTTON_TOUCH | BUTTON_A ) ) != 0;
	bool touchDown = ( vrFrame.Input.buttonState & BUTTON_TOUCH ) != 0;

	// Need to update this for keyboard events as well
	for ( int i = 0; i < vrFrame.Input.NumKeyEvents; i++ )
	{
		if ( vrFrame.Input.KeyEvents[i].KeyCode == OVR_KEY_RETURN )
		{
			switch ( vrFrame.Input.KeyEvents[i].EventType )
			{
				case KEY_EVENT_DOWN:
					touchPressed = true;
					break;
				case KEY_EVENT_UP:
					touchReleased = true;
					break;
				default:
					break;
			}
		}
	}

 /*   
	// report swipe data
	char const * swipeNames[5] = { "none", "down", "up", "back", "forward" };
//.........这里部分代码省略.........
开发者ID:8BitRick,项目名称:GearVRNative,代码行数:101,代码来源:VRMenuEventHandler.cpp

示例3: Frame

//==============================
// VRMenuEventHandler::Frame
void VRMenuEventHandler::Frame( App * app, VrFrame const & vrFrame, OvrVRMenuMgr & menuMgr, BitmapFont const & font,
                                menuHandle_t const & rootHandle,Posef const & menuPose, gazeCursorUserId_t const & gazeUserId,
                                Array< VRMenuEvent > & events )
{
    VRMenuObject * root = menuMgr.ToObject( rootHandle );
    if ( root == NULL )
    {
        return;
    }

    // find the object the gaze is touching and update gaze focus
    const Matrix4f viewMatrix = app->GetLastViewMatrix();
    const Vector3f viewPos( GetViewMatrixPosition( viewMatrix ) );
    const Vector3f viewFwd( GetViewMatrixForward( viewMatrix ) );

    HitTestResult result;
    menuHandle_t hitHandle = root->HitTest( app, menuMgr, font, menuPose, viewPos, viewFwd, ContentFlags_t( CONTENT_SOLID ), result );
    result.RayStart = viewPos;
    result.RayDir = viewFwd;

    VRMenuObject * hit = hitHandle.IsValid() ? menuMgr.ToObject( hitHandle ) : NULL;
    app->GetGazeCursor().UpdateForUser( gazeUserId, result.t, ( hit != NULL && !( hit->GetFlags() & VRMenuObjectFlags_t( VRMENUOBJECT_NO_GAZE_HILIGHT ) ) ) ? CURSOR_STATE_HILIGHT : CURSOR_STATE_NORMAL );
    /*
        if ( hit != NULL )
        {
            app->ShowInfoText( 0.0f, "%s", hit->GetText().ToCStr() );
        }
    */
    bool focusChanged = ( hitHandle != FocusedHandle );
    if ( focusChanged )
    {
        // focus changed
        VRMenuObject * oldFocus = menuMgr.ToObject( FocusedHandle );
        if ( oldFocus != NULL )
        {
            // setup event for item losing the focus
            VRMenuEvent event( VRMENU_EVENT_FOCUS_LOST, EVENT_DISPATCH_TARGET, FocusedHandle, Vector3f( 0.0f ), result );
            events.PushBack( event );
        }
        if ( hit != NULL )
        {
            if ( ( hit->GetFlags() & VRMENUOBJECT_FLAG_NO_FOCUS_GAINED ) == 0 )
            {
                // set up event for item gaining the focus
                VRMenuEvent event( VRMENU_EVENT_FOCUS_GAINED, EVENT_DISPATCH_FOCUS, hitHandle, Vector3f( 0.0f ), result );
                events.PushBack( event );
            }
        }
        FocusedHandle = hitHandle;
    }

    bool touchPressed = ( vrFrame.Input.buttonPressed & ( BUTTON_TOUCH | BUTTON_A ) ) != 0;
    bool touchReleased = !touchPressed && ( vrFrame.Input.buttonReleased & ( BUTTON_TOUCH | BUTTON_A ) ) != 0;
    bool touchDown = ( vrFrame.Input.buttonState & BUTTON_TOUCH ) != 0;

    if ( ( vrFrame.Input.buttonPressed & BUTTON_SWIPE_UP ) != 0 )
    {
        VRMenuEvent event( VRMENU_EVENT_SWIPE_UP, EVENT_DISPATCH_FOCUS, FocusedHandle, Vector3f( 0.0f ), result );
        events.PushBack( event );
    }
    if ( ( vrFrame.Input.buttonPressed & BUTTON_SWIPE_DOWN ) != 0 )
    {
        VRMenuEvent event( VRMENU_EVENT_SWIPE_DOWN, EVENT_DISPATCH_FOCUS, FocusedHandle, Vector3f( 0.0f ), result );
        events.PushBack( event );

    }
    if ( ( vrFrame.Input.buttonPressed & BUTTON_SWIPE_FORWARD ) != 0 )
    {
        VRMenuEvent event( VRMENU_EVENT_SWIPE_FORWARD, EVENT_DISPATCH_FOCUS, FocusedHandle, Vector3f( 0.0f ), result );
        events.PushBack( event );

    }
    if ( ( vrFrame.Input.buttonPressed & BUTTON_SWIPE_BACK ) != 0 )
    {
        VRMenuEvent event( VRMENU_EVENT_SWIPE_BACK, EVENT_DISPATCH_FOCUS, FocusedHandle, Vector3f( 0.0f ), result );
        events.PushBack( event );
    }

    /*
       // report swipe data
       char const * swipeNames[5] = { "none", "down", "up", "back", "forward" };
       int swipeUpDown = ( vrFrame.Input.buttonPressed & BUTTON_SWIPE_UP ) ? 2 : 0;
       swipeUpDown = ( vrFrame.Input.buttonPressed & BUTTON_SWIPE_DOWN ) ? 1 : swipeUpDown;
       int swipeForwardBack = ( vrFrame.Input.buttonPressed & BUTTON_SWIPE_FORWARD ) ? 4 : 0;
       swipeForwardBack = ( vrFrame.Input.buttonPressed & BUTTON_SWIPE_BACK ) ? 3 : swipeForwardBack;

       app->ShowInfoText( 1.0f, "touch %s\n( %s, %s )\n( %.2f, %.2f )\n( %.2f, %.2f )",
               touchDown ? swipeNames[1] : swipeNames[2],
               swipeNames[swipeUpDown], swipeNames[swipeForwardBack],
               vrFrame.Input.touch[0], vrFrame.Input.touch[1],
               vrFrame.Input.touchRelative[0], vrFrame.Input.touchRelative[1] );
    */
    // if nothing is focused, send events to the root
    if ( touchPressed )
    {
        VRMenuEvent event( VRMENU_EVENT_TOUCH_DOWN, EVENT_DISPATCH_FOCUS, FocusedHandle, Vector3f( 0.0f ), result );
        events.PushBack( event );
    }
//.........这里部分代码省略.........
开发者ID:colwalder,项目名称:unrealengine,代码行数:101,代码来源:VRMenuEventHandler.cpp


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