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


C++ Director::getTouchDispatcher方法代码示例

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


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

示例1: init

bool MainGameLayer::init()
{
	isLeftTouched = false;
	isSwipeStart = false;
	iSwipeStartY = 0;
	iSwipeEndY = 0;

	// Touch
	Director* director = Director::getInstance();
    director->getTouchDispatcher()->addTargetedDelegate(this, 0, true);

	// box2d physics
	Box2dDirectorLayer* box2dDL = Box2dDirectorLayer::create();
	addChild(box2dDL, 1, kTagLayerBox2dD);

	// background
	initBackground();

	// HUD
	initHUD();

	// Particles
	_bladeSparkle = ParticleSystemQuad::create("Particles/blade_sparkle.plist");
	_bladeSparkle->stopSystem();
	addChild(_bladeSparkle, 3);

	// Sounds
	SimpleAudioEngine::getInstance()->preloadEffect("Sounds/swoosh.caf");
	SimpleAudioEngine::getInstance()->preloadEffect("Sounds/squash.caf");
	SimpleAudioEngine::getInstance()->preloadEffect("Sounds/toss_consecutive.caf");
	SimpleAudioEngine::getInstance()->preloadEffect("Sounds/toss_simultaneous.caf");
	SimpleAudioEngine::getInstance()->preloadEffect("Sounds/toss_bomb.caf");
	SimpleAudioEngine::getInstance()->preloadEffect("Sounds/lose_life.caf");
	SimpleAudioEngine::getInstance()->playBackgroundMusic("Sounds/nature_bgm.aifc");
	_timeCurrent = 0;

	//// TMX
	/*TileMapLayer* tilemapL = TileMapLayer::create();
	addChild(tilemapL, 1, kTagTileMap);
	tilemapL->createWithTMX("grassMap.tmx");	*/

	//addMissionaries();

	// polygon sprite
	/*PolygonSprite *sprite = (new Watermelon())->initWithWorld(box2dDL->world);
	addChild(sprite, 1);
	sprite->activateCollisions();*/

	// Raycast
	//_raycastCallback = new RaycastCallback();

	return true;
}
开发者ID:rtothecore,项目名称:SaladMaker,代码行数:53,代码来源:MainGameScene.cpp

示例2:

//------------------------------------------------------------------
//
// MainGameLayer3
//
//------------------------------------------------------------------
bool MainGameLayer3::init()
{
	iMaxFeet = MAX_DIVE_FEET_AT_ONE_SCENE;
	iTagForMarinelife = kTagLayerSquid;

	// Add background sprite
	addBackground();

	// Touch
	Director* director = Director::getInstance();
    director->getTouchDispatcher()->addTargetedDelegate(this, 0, true);

	return true;
}
开发者ID:rtothecore,项目名称:GrandBlue,代码行数:19,代码来源:MainGameScene3.cpp

示例3: init

bool SeahorseLayer::init()
{
	isBye = false;
	byePoint = 0;
	isHeadToLeft = true;
	isAttachedToDiver = false;

	initWithPlist(p_Seahorse, s_Seahorse);

	//touch
	Director* director = Director::getInstance();
    director->getTouchDispatcher()->addTargetedDelegate(this, 0, true);
	
	return true;
}
开发者ID:rtothecore,项目名称:GrandBlue,代码行数:15,代码来源:Seahorse.cpp

示例4: init

//------------------------------------------------------------------
//
// MainGameLayer
//
//------------------------------------------------------------------
bool MainGameLayer::init()
{
    if ( !Layer::init() )
    {
        return false;
    }

	isRunningEffect = false;

	//touch
	Director* director = Director::getInstance();
    director->getTouchDispatcher()->addTargetedDelegate(this, 0, true);

	addBackground();

    return true;
}
开发者ID:rtothecore,项目名称:UruruTheInvasion,代码行数:22,代码来源:MainGameScene.cpp

示例5:

//------------------------------------------------------------------
//
// MainGameLayer2
//
//------------------------------------------------------------------
bool MainGameLayer2::init()
{
	iMaxFeet = MAX_DIVE_FEET_AT_ONE_SCENE;
	iTagForMarinelife = kTagLayerTurtle;

	// Add background sprite
	addBackground();

	// Touch
	Director* director = Director::getInstance();
    director->getTouchDispatcher()->addTargetedDelegate(this, 0, true);

	// ADMOB JNI
	AdmobJNI::setAdmobVisible(true, true);

	return true;
}
开发者ID:rtothecore,项目名称:GrandBlue,代码行数:22,代码来源:MainGameScene2.cpp

示例6: onExit

void Layer::onExit()
{
    Director* pDirector = Director::getInstance();
    if( _touchEnabled )
    {
        pDirector->getTouchDispatcher()->removeDelegate(this);
    }

    // remove this layer from the delegates who concern Accelerometer Sensor
    if (_accelerometerEnabled)
    {
		pDirector->getAccelerometer()->setDelegate(nullptr);
    }

    // remove this layer from the delegates who concern the keypad msg
    if (_keypadEnabled)
    {
        pDirector->getKeypadDispatcher()->removeDelegate(this);
    }

    Node::onExit();
}
开发者ID:KIngpon,项目名称:HXGame,代码行数:22,代码来源:CCLayer.cpp

示例7: onExit

void MainGameLayer::onExit()
{
    Director* director = Director::getInstance();
    director->getTouchDispatcher()->removeDelegate(this);
    Layer::onExit();
}
开发者ID:rtothecore,项目名称:UruruTheInvasion,代码行数:6,代码来源:MainGameScene.cpp

示例8:

void TouchesPerformTest1::registerWithTouchDispatcher()
{
    Director* director = Director::getInstance();
    director->getTouchDispatcher()->addTargetedDelegate(this, 0, true);
}
开发者ID:CBanDa,项目名称:cocos2d-x-3.0alpha0-pre,代码行数:5,代码来源:PerformanceTouchesTest.cpp

示例9:

void TouchesPerformTest1::registerWithTouchDispatcher()
{
    Director* pDirector = Director::sharedDirector();
    pDirector->getTouchDispatcher()->addTargetedDelegate(this, 0, true);
}
开发者ID:bassarisse,项目名称:LostInCaves,代码行数:5,代码来源:PerformanceTouchesTest.cpp


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