mirror of https://github.com/axmolengine/axmol.git
closed #4559: Wrong behavior of multi-touch on iphone5s/ipadAir (arm64 arch)
This commit is contained in:
parent
ec8de6b402
commit
691442d80d
|
@ -37,7 +37,7 @@ namespace {
|
|||
static Touch* g_touches[EventTouch::MAX_TOUCHES] = { nullptr };
|
||||
static unsigned int g_indexBitsUsed = 0;
|
||||
// System touch pointer ID (It may not be ascending order number) <-> Ascending order number from 0
|
||||
static std::map<int, int> g_touchIdReorderMap;
|
||||
static std::map<intptr_t, int> g_touchIdReorderMap;
|
||||
|
||||
static int getUnUsedIndex()
|
||||
{
|
||||
|
@ -235,9 +235,9 @@ const std::string& GLViewProtocol::getViewName() const
|
|||
return _viewName;
|
||||
}
|
||||
|
||||
void GLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[], float ys[])
|
||||
void GLViewProtocol::handleTouchesBegin(int num, intptr_t ids[], float xs[], float ys[])
|
||||
{
|
||||
int id = 0;
|
||||
intptr_t id = 0;
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
int unusedIndex = 0;
|
||||
|
@ -285,9 +285,9 @@ void GLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[], float ys
|
|||
dispatcher->dispatchEvent(&touchEvent);
|
||||
}
|
||||
|
||||
void GLViewProtocol::handleTouchesMove(int num, int ids[], float xs[], float ys[])
|
||||
void GLViewProtocol::handleTouchesMove(int num, intptr_t ids[], float xs[], float ys[])
|
||||
{
|
||||
int id = 0;
|
||||
intptr_t id = 0;
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
EventTouch touchEvent;
|
||||
|
@ -317,7 +317,7 @@ void GLViewProtocol::handleTouchesMove(int num, int ids[], float xs[], float ys[
|
|||
else
|
||||
{
|
||||
// It is error, should return.
|
||||
CCLOG("Moving touches with id: %d error", id);
|
||||
CCLOG("Moving touches with id: %ld error", id);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -333,9 +333,9 @@ void GLViewProtocol::handleTouchesMove(int num, int ids[], float xs[], float ys[
|
|||
dispatcher->dispatchEvent(&touchEvent);
|
||||
}
|
||||
|
||||
void GLViewProtocol::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num, int ids[], float xs[], float ys[])
|
||||
void GLViewProtocol::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num, intptr_t ids[], float xs[], float ys[])
|
||||
{
|
||||
int id = 0;
|
||||
intptr_t id = 0;
|
||||
float x = 0.0f;
|
||||
float y = 0.0f;
|
||||
EventTouch touchEvent;
|
||||
|
@ -370,7 +370,7 @@ void GLViewProtocol::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode,
|
|||
}
|
||||
else
|
||||
{
|
||||
CCLOG("Ending touches with id: %d error", id);
|
||||
CCLOG("Ending touches with id: %ld error", id);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -393,12 +393,12 @@ void GLViewProtocol::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode,
|
|||
}
|
||||
}
|
||||
|
||||
void GLViewProtocol::handleTouchesEnd(int num, int ids[], float xs[], float ys[])
|
||||
void GLViewProtocol::handleTouchesEnd(int num, intptr_t ids[], float xs[], float ys[])
|
||||
{
|
||||
handleTouchesOfEndOrCancel(EventTouch::EventCode::ENDED, num, ids, xs, ys);
|
||||
}
|
||||
|
||||
void GLViewProtocol::handleTouchesCancel(int num, int ids[], float xs[], float ys[])
|
||||
void GLViewProtocol::handleTouchesCancel(int num, intptr_t ids[], float xs[], float ys[])
|
||||
{
|
||||
handleTouchesOfEndOrCancel(EventTouch::EventCode::CANCELLED, num, ids, xs, ys);
|
||||
}
|
||||
|
|
|
@ -160,10 +160,10 @@ public:
|
|||
const std::string& getViewName() const;
|
||||
|
||||
/** Touch events are handled by default; if you want to customize your handlers, please override these functions: */
|
||||
virtual void handleTouchesBegin(int num, int ids[], float xs[], float ys[]);
|
||||
virtual void handleTouchesMove(int num, int ids[], float xs[], float ys[]);
|
||||
virtual void handleTouchesEnd(int num, int ids[], float xs[], float ys[]);
|
||||
virtual void handleTouchesCancel(int num, int ids[], float xs[], float ys[]);
|
||||
virtual void handleTouchesBegin(int num, intptr_t ids[], float xs[], float ys[]);
|
||||
virtual void handleTouchesMove(int num, intptr_t ids[], float xs[], float ys[]);
|
||||
virtual void handleTouchesEnd(int num, intptr_t ids[], float xs[], float ys[]);
|
||||
virtual void handleTouchesCancel(int num, intptr_t ids[], float xs[], float ys[]);
|
||||
|
||||
/**
|
||||
* Get the opengl view port rectangle.
|
||||
|
@ -186,7 +186,7 @@ public:
|
|||
protected:
|
||||
void updateDesignResolutionSize();
|
||||
|
||||
void handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num, int ids[], float xs[], float ys[]);
|
||||
void handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num, intptr_t ids[], float xs[], float ys[]);
|
||||
|
||||
// real screen size
|
||||
Size _screenSize;
|
||||
|
|
|
@ -408,7 +408,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
|||
}
|
||||
|
||||
auto glview = cocos2d::Director::getInstance()->getOpenGLView();
|
||||
glview->handleTouchesBegin(i, (int*)ids, xs, ys);
|
||||
glview->handleTouchesBegin(i, (intptr_t*)ids, xs, ys);
|
||||
}
|
||||
|
||||
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
|
||||
|
@ -430,7 +430,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
|||
}
|
||||
|
||||
auto glview = cocos2d::Director::getInstance()->getOpenGLView();
|
||||
glview->handleTouchesMove(i, (int*)ids, xs, ys);
|
||||
glview->handleTouchesMove(i, (intptr_t*)ids, xs, ys);
|
||||
}
|
||||
|
||||
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
|
||||
|
@ -453,7 +453,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
|||
}
|
||||
|
||||
auto glview = cocos2d::Director::getInstance()->getOpenGLView();
|
||||
glview->handleTouchesEnd(i, (int*)ids, xs, ys);
|
||||
glview->handleTouchesEnd(i, (intptr_t*)ids, xs, ys);
|
||||
}
|
||||
|
||||
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event
|
||||
|
@ -476,7 +476,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved.
|
|||
}
|
||||
|
||||
auto glview = cocos2d::Director::getInstance()->getOpenGLView();
|
||||
glview->handleTouchesCancel(i, (int*)ids, xs, ys);
|
||||
glview->handleTouchesCancel(i, (intptr_t*)ids, xs, ys);
|
||||
}
|
||||
|
||||
#pragma mark - UIView - Responder
|
||||
|
|
|
@ -137,7 +137,7 @@ protected:
|
|||
std::mutex _DebugStringsMutex;
|
||||
std::vector<std::string> _DebugStrings;
|
||||
|
||||
int _touchId;
|
||||
intptr_t _touchId;
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Console);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue