MCPcopy Create free account
hub / github.com/axmolengine/axmol / onTouchesBegan

Method onTouchesBegan

tests/cpp-tests/Source/ShaderTest/ShaderTest2.cpp:570–584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

568}
569
570void EffectSpriteLamp::onTouchesBegan(const std::vector<Touch*>& touches, Event* unused_event)
571{
572 for (auto&&item : touches)
573 {
574 auto touch = item;
575 auto s = Director::getInstance()->getWinSize();
576 Point loc_winSpace = touch->getLocationInView();
577 _lightSprite->setPosition(Vec2(loc_winSpace.x, s.height - loc_winSpace.y));
578 Vec3 pos(loc_winSpace.x, loc_winSpace.y, 50);
579 Mat4 mat = _sprite->getNodeToWorldTransform();
580 Point lightPosInLocalSpace =
581 PointApplyAffineTransform(Vec2(pos.x, pos.y), _sprite->getWorldToNodeAffineTransform());
582 ((EffectNormalMapped*)_effect)->setLightPos(Vec3(lightPosInLocalSpace.x, lightPosInLocalSpace.y, 50.0f));
583 }
584}
585
586void EffectSpriteLamp::onTouchesMoved(const std::vector<Touch*>& touches, Event* unused_event)
587{

Callers

nothing calls this directly

Calls 9

getInstanceFunction · 0.85
setLightPosMethod · 0.80
Vec2Function · 0.50
Vec3Function · 0.50
getLocationInViewMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected