@@ -397,6 +397,10 @@ Sprite3DEffectTest::Sprite3DEffectTest()
397397{
398398 auto s = Director::getInstance ()->getWinSize ();
399399 addNewSpriteWithCoords ( Vec2 (s.width /2 , s.height /2 ) );
400+
401+ auto listener = EventListenerTouchAllAtOnce::create ();
402+ listener->onTouchesEnded = CC_CALLBACK_2 (Sprite3DEffectTest::onTouchesEnded, this );
403+ _eventDispatcher->addEventListenerWithSceneGraphPriority (listener, this );
400404}
401405
402406std::string Sprite3DEffectTest::title () const
@@ -414,10 +418,11 @@ void Sprite3DEffectTest::addNewSpriteWithCoords(Vec2 p)
414418 auto sprite = EffectSprite3D::createFromObjFileAndTexture (" Sprite3DTest/boss1.obj" , " Sprite3DTest/boss.png" );
415419 Effect3DOutline* effect = Effect3DOutline::create ();
416420 effect->setOutlineColor (Vec3 (1 ,0 ,0 ));
417- effect->setOutlineWidth (0.1 );
421+ effect->setOutlineWidth (0.001 );
418422 sprite->addEffect (effect, -1 );
419423 Effect3DOutline* effect2 = Effect3DOutline::create ();
420- effect->setOutlineWidth (0.3 );
424+ effect2->setOutlineWidth (0.002 );
425+ effect2->setOutlineColor (Vec3 (1 ,1 ,0 ));
421426 sprite->addEffect (effect2, -2 );
422427 // sprite->setEffect3D(effect);
423428 sprite->setScale (6 .f );
@@ -445,3 +450,13 @@ void Sprite3DEffectTest::addNewSpriteWithCoords(Vec2 p)
445450
446451 sprite->runAction ( RepeatForever::create (seq) );
447452}
453+
454+ void Sprite3DEffectTest::onTouchesEnded (const std::vector<Touch*>& touches, Event* event)
455+ {
456+ for (auto touch: touches)
457+ {
458+ auto location = touch->getLocation ();
459+
460+ addNewSpriteWithCoords ( location );
461+ }
462+ }
0 commit comments