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

Method onTouchEnded

extensions/GUI/src/GUI/ControlExtension/ControlSwitch.cpp:416–430  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

414}
415
416void ControlSwitch::onTouchEnded(Touch* pTouch, Event* /*pEvent*/)
417{
418 Vec2 location = this->locationFromTouch(pTouch);
419
420 _switchSprite->getThumbSprite()->setColor(Color3B::WHITE);
421
422 if (hasMoved())
423 {
424 setOn(!(location.x < _switchSprite->getContentSize().width / 2), true);
425 }
426 else
427 {
428 setOn(!_on, true);
429 }
430}
431
432void ControlSwitch::onTouchCancelled(Touch* pTouch, Event* /*pEvent*/)
433{

Callers

nothing calls this directly

Calls 4

locationFromTouchMethod · 0.95
hasMovedFunction · 0.85
setColorMethod · 0.45
getContentSizeMethod · 0.45

Tested by

no test coverage detected