FreshRSS

Normální zobrazení

Jsou dostupné nové články, klikněte pro obnovení stránky.
PředevčíremHlavní kanál
  • ✇Recent Questions - Game Development Stack Exchange
  • Counting multiple touches using Cocos2dx 3.2DGomez
    I'm trying to count the number of active touches in screen in order to perform an an action in case that there are two touches: auto jumpListener = EventListenerTouchAllAtOnce::create(); jumpListener->onTouchesBegan = [=](const std::vector<Touch*>& touches, Event* event) { CCLOG("Multi-touch detected %d", touches.size()); if(touches.size() == 2) { this->_player->jump(); } }; But even if I'm touching with two fingers,
     

Counting multiple touches using Cocos2dx 3.2

I'm trying to count the number of active touches in screen in order to perform an an action in case that there are two touches:

auto jumpListener = EventListenerTouchAllAtOnce::create();
    jumpListener->onTouchesBegan = [=](const std::vector<Touch*>& touches, Event* event)
    {
        CCLOG("Multi-touch detected %d", touches.size());
        if(touches.size() == 2)
        {
            this->_player->jump();
        }

    };

But even if I'm touching with two fingers, I get that only 1 touch has been made, any suggestions?

❌
❌