本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例7: onExit
void MainGameLayer::onExit()
{
Director* director = Director::getInstance();
director->getTouchDispatcher()->removeDelegate(this);
Layer::onExit();
}
示例8:
void TouchesPerformTest1::registerWithTouchDispatcher()
{
Director* director = Director::getInstance();
director->getTouchDispatcher()->addTargetedDelegate(this, 0, true);
}
示例9:
void TouchesPerformTest1::registerWithTouchDispatcher()
{
Director* pDirector = Director::sharedDirector();
pDirector->getTouchDispatcher()->addTargetedDelegate(this, 0, true);
}