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

Method onTouchesEnded

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

Source from the content-addressed store, hash-verified

600}
601
602void EffectSpriteLamp::onTouchesEnded(const std::vector<Touch*>& touches, Event* unused_event)
603{
604 for (auto&&item : touches)
605 {
606 auto touch = item;
607 auto s = Director::getInstance()->getWinSize();
608 Point loc_winSpace = touch->getLocationInView();
609 _lightSprite->setPosition(Vec2(loc_winSpace.x, s.height - loc_winSpace.y));
610 Vec3 pos(loc_winSpace.x, loc_winSpace.y, 50);
611 Mat4 mat = _sprite->getNodeToWorldTransform();
612 Point lightPosInLocalSpace =
613 PointApplyAffineTransform(Vec2(pos.x, pos.y), _sprite->getWorldToNodeAffineTransform());
614 ((EffectNormalMapped*)_effect)->setLightPos(Vec3(lightPosInLocalSpace.x, lightPosInLocalSpace.y, 50.0f));
615 }
616}

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