EventListenerTouchAllAtOnceのonTouchesMoved()とかで
手に入るtouches[n]には getID() があるので、それを使ってどの指か管理できます。
たとえば、
C++
1class Foo {
2 class Tracking {
3 public:
4 bool isTouch;
5 cocos2d::Vec2 loc;
6 cocos2d::Vec2 delta;
7
8 Tracking() { isTouch = false; loc = cocos2d::Vec2::ZERO; delta = cocos2d::Vec2::ZERO; }
9 };
10
11 std::vector<Tracking> touchTrackers;
12}
13
14
15 touchTrackers.clear();
16 for (int i = 0; i < 10; i++) { // 5個あればいいらしいけど
17 touchTrackers.push_back(Tracking());
18 }
19
20 auto listener = EventListenerTouchAllAtOnce::create();
21 listener->onTouchesBegan = [this](const std::vector<Touch*> &touches, Event* event) {
22 for (auto t : touches) {
23 touchTrackers[t->getID()].isTouch = true;
24 touchTrackers[t->getID()].loc = t->getLocation();
25 }
26 };
27 listener->onTouchesMoved = [this](const std::vector<Touch*> &touches, Event* event) {
28 for (auto t : touches) {
29 touchTrackers[t->getID()].delta = t->getDelta();
30 touchTrackers[t->getID()].loc = t->getLocation();
31 }
32 };
33 listener->onTouchesEnded = [this](const std::vector<Touch*> &touches, Event* event) {
34 for (auto t : touches) {
35 touchTrackers[t->getID()].isTouch = false;
36 touchTrackers[t->getID()].loc = Vec2::ZERO;
37 }
38 };
39 node->getEventDispatcher()->addEventListenerWithSceneGraphPriority(listener, node);
40
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。