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

Method onTouchesMoved

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

Source from the content-addressed store, hash-verified

584}
585
586void EffectSpriteLamp::onTouchesMoved(const std::vector<Touch*>& touches, Event* unused_event)
587{
588 for (auto&&item : touches)
589 {
590 auto touch = item;
591 auto s = Director::getInstance()->getWinSize();
592 Point loc_winSpace = touch->getLocationInView();
593 _lightSprite->setPosition(Vec2(loc_winSpace.x, s.height - loc_winSpace.y));
594 Vec3 pos(loc_winSpace.x, loc_winSpace.y, 50);
595 Mat4 mat = _sprite->getNodeToWorldTransform();
596 Point lightPosInLocalSpace =
597 PointApplyAffineTransform(Vec2(pos.x, pos.y), _sprite->getWorldToNodeAffineTransform());
598 ((EffectNormalMapped*)_effect)->setLightPos(Vec3(lightPosInLocalSpace.x, lightPosInLocalSpace.y, 50.0f));
599 }
600}
601
602void EffectSpriteLamp::onTouchesEnded(const std::vector<Touch*>& touches, Event* unused_event)
603{

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