Merge pull request #759 from minggo/iss737_remove_viewid

fixed #737: remove view id
This commit is contained in:
minggo 2012-03-07 21:38:08 -08:00
commit 88cbdcb1ea
27 changed files with 72 additions and 78 deletions

View File

@ -1211,13 +1211,13 @@ CCPoint CCNode::convertToWindowSpace(const CCPoint& nodePoint)
// convenience methods which take a CCTouch instead of CCPoint // convenience methods which take a CCTouch instead of CCPoint
CCPoint CCNode::convertTouchToNodeSpace(CCTouch *touch) CCPoint CCNode::convertTouchToNodeSpace(CCTouch *touch)
{ {
CCPoint point = touch->locationInView(touch->view()); CCPoint point = touch->locationInView();
point = CCDirector::sharedDirector()->convertToGL(point); point = CCDirector::sharedDirector()->convertToGL(point);
return this->convertToNodeSpace(point); return this->convertToNodeSpace(point);
} }
CCPoint CCNode::convertTouchToNodeSpaceAR(CCTouch *touch) CCPoint CCNode::convertTouchToNodeSpaceAR(CCTouch *touch)
{ {
CCPoint point = touch->locationInView(touch->view()); CCPoint point = touch->locationInView();
point = CCDirector::sharedDirector()->convertToGL(point); point = CCDirector::sharedDirector()->convertToGL(point);
return this->convertToNodeSpaceAR(point); return this->convertToNodeSpaceAR(point);
} }

View File

@ -34,27 +34,21 @@ class CCTouch : public CCObject
{ {
public: public:
CCTouch() {} CCTouch() {}
CCTouch(int nViewId, float x, float y) : m_nViewId(nViewId), m_point(x, y), m_prevPoint(x, y) {} CCTouch(float x, float y) : m_point(x, y), m_prevPoint(x, y) {}
CCPoint locationInView(int nViewId) {CC_UNUSED_PARAM(nViewId); return m_point; } CCPoint locationInView() { return m_point; }
CCPoint previousLocationInView(int nViewId) {CC_UNUSED_PARAM(nViewId); return m_prevPoint; } CCPoint previousLocationInView() { return m_prevPoint; }
int view() { return m_nViewId; }
int id(){ return m_iID; }
void SetTouchInfo(int nViewId, float x, float y, int iID=0) void SetTouchInfo(float x, float y)
{ {
m_nViewId = nViewId;
m_prevPoint = m_point; m_prevPoint = m_point;
m_point.x = x; m_point.x = x;
m_point.y = y; m_point.y = y;
m_iID = iID;
} }
private: private:
int m_nViewId;
CCPoint m_point; CCPoint m_point;
CCPoint m_prevPoint; CCPoint m_prevPoint;
int m_iID;
}; };
class CCEvent : public CCObject class CCEvent : public CCObject

View File

@ -587,7 +587,7 @@ namespace cocos2d{
CCMenuItem* CCMenu::itemForTouch(CCTouch *touch) CCMenuItem* CCMenu::itemForTouch(CCTouch *touch)
{ {
CCPoint touchLocation = touch->locationInView(touch->view()); CCPoint touchLocation = touch->locationInView();
touchLocation = CCDirector::sharedDirector()->convertToGL(touchLocation); touchLocation = CCDirector::sharedDirector()->convertToGL(touchLocation);
if (m_pChildren && m_pChildren->count() > 0) if (m_pChildren && m_pChildren->count() > 0)

View File

@ -59,7 +59,7 @@ static CCTouch *s_pTouches[MAX_TOUCHES] = { NULL };
LOGD("Beginning touches with id: %d, x=%f, y=%f", id, x, y); LOGD("Beginning touches with id: %d, x=%f, y=%f", id, x, y);
pTouch = new CCTouch(); pTouch = new CCTouch();
pTouch->SetTouchInfo(0, (x - rcRect.origin.x) / fScreenScaleFactor, (y - rcRect.origin.y) / fScreenScaleFactor, id); pTouch->SetTouchInfo((x - rcRect.origin.x) / fScreenScaleFactor, (y - rcRect.origin.y) / fScreenScaleFactor, id);
s_pTouches[id] = pTouch; s_pTouches[id] = pTouch;
set.addObject(pTouch); set.addObject(pTouch);
@ -83,7 +83,7 @@ static CCTouch *s_pTouches[MAX_TOUCHES] = { NULL };
{ {
LOGD("Ending touches with id: %d, x=%f, y=%f", id, x, y); LOGD("Ending touches with id: %d, x=%f, y=%f", id, x, y);
pTouch->SetTouchInfo(0, (x - rcRect.origin.x) / fScreenScaleFactor , (y - rcRect.origin.y) / fScreenScaleFactor, id); pTouch->SetTouchInfo((x - rcRect.origin.x) / fScreenScaleFactor , (y - rcRect.origin.y) / fScreenScaleFactor, id);
set.addObject(pTouch); set.addObject(pTouch);
// release the object // release the object
@ -115,7 +115,7 @@ static CCTouch *s_pTouches[MAX_TOUCHES] = { NULL };
cocos2d::CCTouch* pTouch = s_pTouches[id[i]]; cocos2d::CCTouch* pTouch = s_pTouches[id[i]];
if (pTouch) if (pTouch)
{ {
pTouch->SetTouchInfo(0, (x[i] - rcRect.origin.x) / fScreenScaleFactor , pTouch->SetTouchInfo((x[i] - rcRect.origin.x) / fScreenScaleFactor ,
(y[i] - rcRect.origin.y) / fScreenScaleFactor, id[i]); (y[i] - rcRect.origin.y) / fScreenScaleFactor, id[i]);
set.addObject(pTouch); set.addObject(pTouch);
} }
@ -148,7 +148,7 @@ static CCTouch *s_pTouches[MAX_TOUCHES] = { NULL };
cocos2d::CCTouch* pTouch = s_pTouches[id[i]]; cocos2d::CCTouch* pTouch = s_pTouches[id[i]];
if (pTouch) if (pTouch)
{ {
pTouch->SetTouchInfo(0, (x[i] - rcRect.origin.x) / fScreenScaleFactor , pTouch->SetTouchInfo((x[i] - rcRect.origin.x) / fScreenScaleFactor ,
(y[i] - rcRect.origin.y) / fScreenScaleFactor, id[i]); (y[i] - rcRect.origin.y) / fScreenScaleFactor, id[i]);
set.addObject(pTouch); set.addObject(pTouch);
s_pTouches[id[i]] = NULL; s_pTouches[id[i]] = NULL;

View File

@ -420,7 +420,7 @@ void CCEGLView::onTouchesBegin(int id[], float x[], float y[], int pointerNumber
if (E_OBJ_NOT_FOUND == r && NULL == pTouch) if (E_OBJ_NOT_FOUND == r && NULL == pTouch)
{ {
pTouch = new CCTouch(); pTouch = new CCTouch();
pTouch->SetTouchInfo(0, (x[i] - m_rcViewPort.origin.x) / m_fScreenScaleFactor, pTouch->SetTouchInfo((x[i] - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
(y[i] - m_rcViewPort.origin.y) / m_fScreenScaleFactor, id[i]); (y[i] - m_rcViewPort.origin.y) / m_fScreenScaleFactor, id[i]);
s_mapTouches.Add(id[i], pTouch); s_mapTouches.Add(id[i], pTouch);
set.addObject(pTouch); set.addObject(pTouch);
@ -444,7 +444,7 @@ void CCEGLView::onTouchesMove(int id[], float x[], float y[], int pointerNumber)
if (E_SUCCESS == r && pTouch != NULL) if (E_SUCCESS == r && pTouch != NULL)
{ {
pTouch->SetTouchInfo(0, (x[i] - m_rcViewPort.origin.x) / m_fScreenScaleFactor, pTouch->SetTouchInfo((x[i] - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
(y[i] - m_rcViewPort.origin.y) / m_fScreenScaleFactor, id[i]); (y[i] - m_rcViewPort.origin.y) / m_fScreenScaleFactor, id[i]);
set.addObject(pTouch); set.addObject(pTouch);
} }
@ -468,7 +468,7 @@ void CCEGLView::onTouchesEnd(int id[], float x[], float y[], int pointerNumber)
r = s_mapTouches.GetValue(id[i], pTouch); r = s_mapTouches.GetValue(id[i], pTouch);
if (E_SUCCESS == r && pTouch != NULL) if (E_SUCCESS == r && pTouch != NULL)
{ {
pTouch->SetTouchInfo(0, (x[i] - m_rcViewPort.origin.x) / m_fScreenScaleFactor, pTouch->SetTouchInfo((x[i] - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
(y[i] - m_rcViewPort.origin.y) / m_fScreenScaleFactor, id[i]); (y[i] - m_rcViewPort.origin.y) / m_fScreenScaleFactor, id[i]);
set.addObject(pTouch); set.addObject(pTouch);
s_mapTouches.Remove(id[i]); s_mapTouches.Remove(id[i]);

View File

@ -413,7 +413,7 @@ static cocos2d::CCTouch *s_pTouches[MAX_TOUCHES];
pTouch = s_pTouches[unUsedIndex] = new cocos2d::CCTouch(); pTouch = s_pTouches[unUsedIndex] = new cocos2d::CCTouch();
float x = [touch locationInView: [touch view]].x; float x = [touch locationInView: [touch view]].x;
float y = [touch locationInView: [touch view]].y; float y = [touch locationInView: [touch view]].y;
pTouch->SetTouchInfo(0, x, y, unUsedIndex); pTouch->SetTouchInfo(x, y, unUsedIndex);
CFDictionaryAddValue(touchesIntergerDict, touch, [NSNumber numberWithInt:unUsedIndex]); CFDictionaryAddValue(touchesIntergerDict, touch, [NSNumber numberWithInt:unUsedIndex]);
@ -446,7 +446,7 @@ static cocos2d::CCTouch *s_pTouches[MAX_TOUCHES];
float x = [touch locationInView: [touch view]].x; float x = [touch locationInView: [touch view]].x;
float y = [touch locationInView: [touch view]].y; float y = [touch locationInView: [touch view]].y;
pTouch->SetTouchInfo(0, x, y, pTouch->id()); pTouch->SetTouchInfo(x, y, pTouch->id());
set.addObject(pTouch); set.addObject(pTouch);
} }
@ -472,7 +472,7 @@ static cocos2d::CCTouch *s_pTouches[MAX_TOUCHES];
float x = [touch locationInView: [touch view]].x; float x = [touch locationInView: [touch view]].x;
float y = [touch locationInView: [touch view]].y; float y = [touch locationInView: [touch view]].y;
pTouch->SetTouchInfo(0, x, y, pTouch->id()); pTouch->SetTouchInfo(x, y, pTouch->id());
set.addObject(pTouch); set.addObject(pTouch);
CFDictionaryRemoveValue(touchesIntergerDict, touch); CFDictionaryRemoveValue(touchesIntergerDict, touch);
@ -502,7 +502,7 @@ static cocos2d::CCTouch *s_pTouches[MAX_TOUCHES];
float x = [touch locationInView: [touch view]].x; float x = [touch locationInView: [touch view]].x;
float y = [touch locationInView: [touch view]].y; float y = [touch locationInView: [touch view]].y;
pTouch->SetTouchInfo(0, x, y, pTouch->id()); pTouch->SetTouchInfo(x, y, pTouch->id());
set.addObject(pTouch); set.addObject(pTouch);
CFDictionaryRemoveValue(touchesIntergerDict, touch); CFDictionaryRemoveValue(touchesIntergerDict, touch);

View File

@ -135,7 +135,7 @@ void mouseButtonEventHandle(int iMouseID,int iMouseState) {
return; return;
} }
s_pMainWindow->m_pTouch->SetTouchInfo(0, (float)(oPoint.x - s_pMainWindow->m_rcViewPort.origin.x) / s_pMainWindow->m_fScreenScaleFactor, s_pMainWindow->m_pTouch->SetTouchInfo((float)(oPoint.x - s_pMainWindow->m_rcViewPort.origin.x) / s_pMainWindow->m_fScreenScaleFactor,
(float)(oPoint.y - s_pMainWindow->m_rcViewPort.origin.y) / s_pMainWindow->m_fScreenScaleFactor); (float)(oPoint.y - s_pMainWindow->m_rcViewPort.origin.y) / s_pMainWindow->m_fScreenScaleFactor);
s_pMainWindow->m_pSet->addObject(s_pMainWindow->m_pTouch); s_pMainWindow->m_pSet->addObject(s_pMainWindow->m_pTouch);
s_pMainWindow->m_mousePoint = oPoint; s_pMainWindow->m_mousePoint = oPoint;

View File

@ -150,7 +150,7 @@ void CCEGLView::setTouch(void* systemData)
{ {
case S3E_POINTER_STATE_DOWN : case S3E_POINTER_STATE_DOWN :
m_bCaptured = true; m_bCaptured = true;
m_pTouch->SetTouchInfo(0, (float)event->m_x, (float)event->m_y); m_pTouch->SetTouchInfo((float)event->m_x, (float)event->m_y);
m_pSet->addObject(m_pTouch); m_pSet->addObject(m_pTouch);
m_pDelegate->touchesBegan(m_pSet, NULL); m_pDelegate->touchesBegan(m_pSet, NULL);
break; break;
@ -158,7 +158,7 @@ void CCEGLView::setTouch(void* systemData)
case S3E_POINTER_STATE_UP : case S3E_POINTER_STATE_UP :
if (m_bCaptured) if (m_bCaptured)
{ {
m_pTouch->SetTouchInfo(0, (float)event->m_x, (float)event->m_y); m_pTouch->SetTouchInfo((float)event->m_x, (float)event->m_y);
m_pDelegate->touchesEnded(m_pSet, NULL); m_pDelegate->touchesEnded(m_pSet, NULL);
m_pSet->removeObject(m_pTouch); m_pSet->removeObject(m_pTouch);
m_bCaptured = false; m_bCaptured = false;
@ -193,14 +193,14 @@ void CCEGLView::setMultiTouch(void* systemData)
switch (event->m_Pressed) switch (event->m_Pressed)
{ {
case S3E_POINTER_STATE_DOWN : case S3E_POINTER_STATE_DOWN :
m_pTouch->SetTouchInfo(0, (float)event->m_x, (float)event->m_y); m_pTouch->SetTouchInfo((float)event->m_x, (float)event->m_y);
m_pSet->addObject(m_pTouch); m_pSet->addObject(m_pTouch);
m_pDelegate->touchesBegan(m_pSet, NULL); m_pDelegate->touchesBegan(m_pSet, NULL);
break; break;
case S3E_POINTER_STATE_UP : case S3E_POINTER_STATE_UP :
{ {
m_pTouch->SetTouchInfo(0, (float)event->m_x, (float)event->m_y); m_pTouch->SetTouchInfo((float)event->m_x, (float)event->m_y);
m_pDelegate->touchesEnded(m_pSet, NULL); m_pDelegate->touchesEnded(m_pSet, NULL);
m_pSet->removeObject(m_pTouch); m_pSet->removeObject(m_pTouch);
touchSet[event->m_TouchID] = NULL; touchSet[event->m_TouchID] = NULL;
@ -356,16 +356,16 @@ void CCEGLView::setScissorInPoints(float x, float y, float w, float h)
} }
} }
void CCEGLView::setIMEKeyboardState(bool bOpen) void CCEGLView::setIMEKeyboardState(bool bOpen)
{ {
if(bOpen && s3eOSReadStringAvailable() == S3E_TRUE) { if(bOpen && s3eOSReadStringAvailable() == S3E_TRUE) {
const char* inputText = s3eOSReadStringUTF8("") ; const char* inputText = s3eOSReadStringUTF8("") ;
if( inputText!=0 ) { if( inputText!=0 ) {
CCIMEDispatcher::sharedDispatcher()->dispatchInsertText(inputText, strlen(inputText)); CCIMEDispatcher::sharedDispatcher()->dispatchInsertText(inputText, strlen(inputText));
} }
} }
} }
CCEGLView& CCEGLView::sharedOpenGLView() CCEGLView& CCEGLView::sharedOpenGLView()
{ {
if( !m_pInstance ) { if( !m_pInstance ) {

View File

@ -953,7 +953,7 @@ bool CCEGLView::HandleEvents()
if (touch) if (touch)
{ {
CCSet set; CCSet set;
touch->SetTouchInfo(0, ((float)(mtouch_event.x) - m_rcViewPort.origin.x) / m_fScreenScaleFactor, touch->SetTouchInfo(((float)(mtouch_event.x) - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
((float)(mtouch_event.y) - m_rcViewPort.origin.y) / m_fScreenScaleFactor); ((float)(mtouch_event.y) - m_rcViewPort.origin.y) / m_fScreenScaleFactor);
set.addObject(touch); set.addObject(touch);
m_pDelegate->touchesEnded(&set, NULL); m_pDelegate->touchesEnded(&set, NULL);
@ -985,7 +985,7 @@ bool CCEGLView::HandleEvents()
if (!touch) if (!touch)
touch = new CCTouch; touch = new CCTouch;
touch->SetTouchInfo(0, ((float)(mtouch_event.x) - m_rcViewPort.origin.x) / m_fScreenScaleFactor, touch->SetTouchInfo(((float)(mtouch_event.x) - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
((float)(mtouch_event.y) - m_rcViewPort.origin.y) / m_fScreenScaleFactor); ((float)(mtouch_event.y) - m_rcViewPort.origin.y) / m_fScreenScaleFactor);
s_pTouches[touch_id] = touch; s_pTouches[touch_id] = touch;
@ -1006,7 +1006,7 @@ bool CCEGLView::HandleEvents()
if (touch) if (touch)
{ {
CCSet set; CCSet set;
touch->SetTouchInfo(0, ((float)(mtouch_event.x) - m_rcViewPort.origin.x) / m_fScreenScaleFactor, touch->SetTouchInfo(((float)(mtouch_event.x) - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
((float)(mtouch_event.y) - m_rcViewPort.origin.y) / m_fScreenScaleFactor); ((float)(mtouch_event.y) - m_rcViewPort.origin.y) / m_fScreenScaleFactor);
set.addObject(touch); set.addObject(touch);
m_pDelegate->touchesMoved(&set, NULL); m_pDelegate->touchesMoved(&set, NULL);
@ -1036,7 +1036,7 @@ bool CCEGLView::HandleEvents()
if (touch) if (touch)
{ {
CCSet set; CCSet set;
touch->SetTouchInfo(0, ((float)(pair[0]) - m_rcViewPort.origin.x) / m_fScreenScaleFactor, touch->SetTouchInfo(((float)(pair[0]) - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
((float)(pair[1]) - m_rcViewPort.origin.y) / m_fScreenScaleFactor); ((float)(pair[1]) - m_rcViewPort.origin.y) / m_fScreenScaleFactor);
set.addObject(touch); set.addObject(touch);
m_pDelegate->touchesMoved(&set, NULL); m_pDelegate->touchesMoved(&set, NULL);
@ -1053,7 +1053,7 @@ bool CCEGLView::HandleEvents()
if (!touch) if (!touch)
touch = new CCTouch; touch = new CCTouch;
touch->SetTouchInfo(0, ((float)(pair[0]) - m_rcViewPort.origin.x) / m_fScreenScaleFactor, touch->SetTouchInfo(((float)(pair[0]) - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
((float)(pair[1]) - m_rcViewPort.origin.y) / m_fScreenScaleFactor); ((float)(pair[1]) - m_rcViewPort.origin.y) / m_fScreenScaleFactor);
s_pTouches[touch_id] = touch; s_pTouches[touch_id] = touch;
@ -1075,7 +1075,7 @@ bool CCEGLView::HandleEvents()
if (touch) if (touch)
{ {
CCSet set; CCSet set;
touch->SetTouchInfo(0, ((float)(pair[0]) - m_rcViewPort.origin.x) / m_fScreenScaleFactor, touch->SetTouchInfo(((float)(pair[0]) - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
((float)(pair[1]) - m_rcViewPort.origin.y) / m_fScreenScaleFactor); ((float)(pair[1]) - m_rcViewPort.origin.y) / m_fScreenScaleFactor);
set.addObject(touch); set.addObject(touch);
m_pDelegate->touchesEnded(&set, NULL); m_pDelegate->touchesEnded(&set, NULL);

View File

@ -285,7 +285,7 @@ LRESULT CCEGLView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{ {
m_bCaptured = true; m_bCaptured = true;
SetCapture(m_hWnd); SetCapture(m_hWnd);
m_pTouch->SetTouchInfo(0, (float)(pt.x - m_rcViewPort.left) / m_fScreenScaleFactor, m_pTouch->SetTouchInfo((float)(pt.x - m_rcViewPort.left) / m_fScreenScaleFactor,
(float)(pt.y - m_rcViewPort.top) / m_fScreenScaleFactor); (float)(pt.y - m_rcViewPort.top) / m_fScreenScaleFactor);
m_pSet->addObject(m_pTouch); m_pSet->addObject(m_pTouch);
m_pDelegate->touchesBegan(m_pSet, NULL); m_pDelegate->touchesBegan(m_pSet, NULL);
@ -296,7 +296,7 @@ LRESULT CCEGLView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
case WM_MOUSEMOVE: case WM_MOUSEMOVE:
if (MK_LBUTTON == wParam && m_bCaptured) if (MK_LBUTTON == wParam && m_bCaptured)
{ {
m_pTouch->SetTouchInfo(0, (float)((short)LOWORD(lParam)- m_rcViewPort.left) / m_fScreenScaleFactor, m_pTouch->SetTouchInfo((float)((short)LOWORD(lParam)- m_rcViewPort.left) / m_fScreenScaleFactor,
(float)((short)HIWORD(lParam) - m_rcViewPort.top) / m_fScreenScaleFactor); (float)((short)HIWORD(lParam) - m_rcViewPort.top) / m_fScreenScaleFactor);
m_pDelegate->touchesMoved(m_pSet, NULL); m_pDelegate->touchesMoved(m_pSet, NULL);
} }
@ -305,7 +305,7 @@ LRESULT CCEGLView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
case WM_LBUTTONUP: case WM_LBUTTONUP:
if (m_bCaptured) if (m_bCaptured)
{ {
m_pTouch->SetTouchInfo(0, (float)((short)LOWORD(lParam)- m_rcViewPort.left) / m_fScreenScaleFactor, m_pTouch->SetTouchInfo((float)((short)LOWORD(lParam)- m_rcViewPort.left) / m_fScreenScaleFactor,
(float)((short)HIWORD(lParam) - m_rcViewPort.top) / m_fScreenScaleFactor); (float)((short)HIWORD(lParam) - m_rcViewPort.top) / m_fScreenScaleFactor);
m_pDelegate->touchesEnded(m_pSet, NULL); m_pDelegate->touchesEnded(m_pSet, NULL);
m_pSet->removeObject(m_pTouch); m_pSet->removeObject(m_pTouch);

View File

@ -182,7 +182,7 @@ void Box2DTestLayer::ccTouchesEnded(CCSet* touches, CCEvent* event)
if(!touch) if(!touch)
break; break;
CCPoint location = touch->locationInView(touch->view()); CCPoint location = touch->locationInView();
location = CCDirector::sharedDirector()->convertToGL(location); location = CCDirector::sharedDirector()->convertToGL(location);

View File

@ -137,8 +137,8 @@ bool MenuLayer::ccTouchBegan(CCTouch* touch, CCEvent* event)
void MenuLayer::ccTouchMoved(CCTouch* touch, CCEvent* event) void MenuLayer::ccTouchMoved(CCTouch* touch, CCEvent* event)
{ {
CCPoint touchLocation = touch->locationInView( touch->view() ); CCPoint touchLocation = touch->locationInView();
CCPoint prevLocation = touch->previousLocationInView( touch->view() ); CCPoint prevLocation = touch->previousLocationInView();
touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation ); touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation );
prevLocation = CCDirector::sharedDirector()->convertToGL( prevLocation ); prevLocation = CCDirector::sharedDirector()->convertToGL( prevLocation );
@ -223,7 +223,7 @@ void Box2DView::registerWithTouchDispatcher()
bool Box2DView::ccTouchBegan(CCTouch* touch, CCEvent* event) bool Box2DView::ccTouchBegan(CCTouch* touch, CCEvent* event)
{ {
CCPoint touchLocation = touch->locationInView( touch->view() ); CCPoint touchLocation = touch->locationInView();
touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation ); touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation );
CCPoint nodePosition = convertToNodeSpace( touchLocation ); CCPoint nodePosition = convertToNodeSpace( touchLocation );
@ -234,7 +234,7 @@ bool Box2DView::ccTouchBegan(CCTouch* touch, CCEvent* event)
void Box2DView::ccTouchMoved(CCTouch* touch, CCEvent* event) void Box2DView::ccTouchMoved(CCTouch* touch, CCEvent* event)
{ {
CCPoint touchLocation = touch->locationInView( touch->view() ); CCPoint touchLocation = touch->locationInView();
touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation ); touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation );
CCPoint nodePosition = convertToNodeSpace( touchLocation ); CCPoint nodePosition = convertToNodeSpace( touchLocation );
@ -243,7 +243,7 @@ void Box2DView::ccTouchMoved(CCTouch* touch, CCEvent* event)
void Box2DView::ccTouchEnded(CCTouch* touch, CCEvent* event) void Box2DView::ccTouchEnded(CCTouch* touch, CCEvent* event)
{ {
CCPoint touchLocation = touch->locationInView( touch->view() ); CCPoint touchLocation = touch->locationInView();
touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation ); touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation );
CCPoint nodePosition = convertToNodeSpace( touchLocation ); CCPoint nodePosition = convertToNodeSpace( touchLocation );

View File

@ -111,7 +111,7 @@ void BugsTestMainLayer::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent)
CCSetIterator it = pTouches->begin(); CCSetIterator it = pTouches->begin();
CCTouch* touch = (CCTouch*)(*it); CCTouch* touch = (CCTouch*)(*it);
m_tBeginPos = touch->locationInView( touch->view() ); m_tBeginPos = touch->locationInView();
m_tBeginPos = CCDirector::sharedDirector()->convertToGL( m_tBeginPos ); m_tBeginPos = CCDirector::sharedDirector()->convertToGL( m_tBeginPos );
} }
@ -120,7 +120,7 @@ void BugsTestMainLayer::ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent)
CCSetIterator it = pTouches->begin(); CCSetIterator it = pTouches->begin();
CCTouch* touch = (CCTouch*)(*it); CCTouch* touch = (CCTouch*)(*it);
CCPoint touchLocation = touch->locationInView( touch->view() ); CCPoint touchLocation = touch->locationInView();
touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation ); touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation );
float nMoveY = touchLocation.y - m_tBeginPos.y; float nMoveY = touchLocation.y - m_tBeginPos.y;

View File

@ -42,7 +42,7 @@ void MainLayer::ccTouchesEnded(CCSet *pTouches, CCEvent *pEvent)
CCSetIterator it = pTouches->begin(); CCSetIterator it = pTouches->begin();
CCTouch* touch = (CCTouch*)(*it); CCTouch* touch = (CCTouch*)(*it);
CCPoint location = touch->locationInView( touch->view() ); CCPoint location = touch->locationInView();
CCPoint convertedLocation = CCDirector::sharedDirector()->convertToGL(location); CCPoint convertedLocation = CCDirector::sharedDirector()->convertToGL(location);
CCNode* s = getChildByTag(kTagSprite); CCNode* s = getChildByTag(kTagSprite);

View File

@ -191,7 +191,7 @@ void CocosDenshionTest::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent)
CCSetIterator it = pTouches->begin(); CCSetIterator it = pTouches->begin();
CCTouch* touch = (CCTouch*)(*it); CCTouch* touch = (CCTouch*)(*it);
m_tBeginPos = touch->locationInView( touch->view() ); m_tBeginPos = touch->locationInView();
m_tBeginPos = CCDirector::sharedDirector()->convertToGL( m_tBeginPos ); m_tBeginPos = CCDirector::sharedDirector()->convertToGL( m_tBeginPos );
} }
@ -200,7 +200,7 @@ void CocosDenshionTest::ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent)
CCSetIterator it = pTouches->begin(); CCSetIterator it = pTouches->begin();
CCTouch* touch = (CCTouch*)(*it); CCTouch* touch = (CCTouch*)(*it);
CCPoint touchLocation = touch->locationInView( touch->view() ); CCPoint touchLocation = touch->locationInView();
touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation ); touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation );
float nMoveY = touchLocation.y - m_tBeginPos.y; float nMoveY = touchLocation.y - m_tBeginPos.y;

View File

@ -816,7 +816,7 @@ void ConvertToNode::ccTouchesEnded(CCSet* touches, CCEvent *event)
for( CCSetIterator it = touches->begin(); it != touches->end(); ++it) for( CCSetIterator it = touches->begin(); it != touches->end(); ++it)
{ {
CCTouch* touch = (CCTouch*)(*it); CCTouch* touch = (CCTouch*)(*it);
CCPoint location = touch->locationInView(touch->view()); CCPoint location = touch->locationInView();
location = CCDirector::sharedDirector()->convertToGL(location); location = CCDirector::sharedDirector()->convertToGL(location);

View File

@ -187,7 +187,7 @@ void Director1::ccTouchesEnded(CCSet * touches, CCEvent* event)
if(!touch) if(!touch)
break; break;
CCPoint a = touch->locationInView(touch->view()); CCPoint a = touch->locationInView();
CCDirector *director = CCDirector::sharedDirector(); CCDirector *director = CCDirector::sharedDirector();
CCPoint b = director->convertToUI(director->convertToGL(a)); CCPoint b = director->convertToUI(director->convertToGL(a));

View File

@ -166,7 +166,7 @@ void LayerTest1::registerWithTouchDispatcher()
void LayerTest1::updateSize(CCTouch*touch) void LayerTest1::updateSize(CCTouch*touch)
{ {
CCPoint touchLocation = touch->locationInView(touch->view()); CCPoint touchLocation = touch->locationInView();
touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation ); touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation );
CCSize s = CCDirector::sharedDirector()->getWinSize(); CCSize s = CCDirector::sharedDirector()->getWinSize();
@ -324,7 +324,7 @@ void LayerGradient::ccTouchesMoved(CCSet * touches, CCEvent *event)
CCSetIterator it = touches->begin(); CCSetIterator it = touches->begin();
CCTouch* touch = (CCTouch*)(*it); CCTouch* touch = (CCTouch*)(*it);
CCPoint start = touch->locationInView(touch->view()); CCPoint start = touch->locationInView();
start = CCDirector::sharedDirector()->convertToGL(start); start = CCDirector::sharedDirector()->convertToGL(start);
CCPoint diff = ccpSub( ccp(s.width/2,s.height/2), start); CCPoint diff = ccpSub( ccp(s.width/2,s.height/2), start);

View File

@ -77,7 +77,7 @@ void MotionStreakTest2::ccTouchesMoved(CCSet* touches, CCEvent* event)
CCSetIterator it = touches->begin(); CCSetIterator it = touches->begin();
CCTouch* touch = (CCTouch*)(*it); CCTouch* touch = (CCTouch*)(*it);
CCPoint touchLocation = touch->locationInView( touch->view() ); CCPoint touchLocation = touch->locationInView();
touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation ); touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation );
m_streak->setPosition( touchLocation ); m_streak->setPosition( touchLocation );

View File

@ -152,8 +152,8 @@ void Parallax2::ccTouchCancelled(CCTouch* touch, CCEvent* event)
void Parallax2::ccTouchMoved(CCTouch* touch, CCEvent* event) void Parallax2::ccTouchMoved(CCTouch* touch, CCEvent* event)
{ {
CCPoint touchLocation = touch->locationInView( touch->view() ); CCPoint touchLocation = touch->locationInView();
CCPoint prevLocation = touch->previousLocationInView( touch->view() ); CCPoint prevLocation = touch->previousLocationInView();
touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation ); touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation );
prevLocation = CCDirector::sharedDirector()->convertToGL( prevLocation ); prevLocation = CCDirector::sharedDirector()->convertToGL( prevLocation );

View File

@ -1140,7 +1140,7 @@ void ParticleDemo::ccTouchMoved(CCTouch* touch, CCEvent* event)
void ParticleDemo::ccTouchEnded(CCTouch* touch, CCEvent* event) void ParticleDemo::ccTouchEnded(CCTouch* touch, CCEvent* event)
{ {
CCPoint location = touch->locationInView( touch->view() ); CCPoint location = touch->locationInView();
CCPoint convertedLocation = CCDirector::sharedDirector()->convertToGL(location); CCPoint convertedLocation = CCDirector::sharedDirector()->convertToGL(location);
CCPoint pos = CCPointZero; CCPoint pos = CCPointZero;

View File

@ -168,9 +168,9 @@ void RenderTextureTest::ccTouchesMoved(CCSet* touches, CCEvent* event)
{ {
CCSetIterator it = touches->begin(); CCSetIterator it = touches->begin();
CCTouch* touch = (CCTouch*)(*it); CCTouch* touch = (CCTouch*)(*it);
CCPoint start = touch->locationInView( touch->view() ); CCPoint start = touch->locationInView();
start = CCDirector::sharedDirector()->convertToGL( start ); start = CCDirector::sharedDirector()->convertToGL( start );
CCPoint end = touch->previousLocationInView( touch->view() ); CCPoint end = touch->previousLocationInView();
end = CCDirector::sharedDirector()->convertToGL(end); end = CCDirector::sharedDirector()->convertToGL(end);
// begin drawing to the render texture // begin drawing to the render texture
@ -296,9 +296,9 @@ RenderTextureSave::~RenderTextureSave()
void RenderTextureSave::ccTouchesMoved(CCSet* touches, CCEvent* event) void RenderTextureSave::ccTouchesMoved(CCSet* touches, CCEvent* event)
{ {
CCTouch *touch = (CCTouch *)touches->anyObject(); CCTouch *touch = (CCTouch *)touches->anyObject();
CCPoint start = touch->locationInView(touch->view()); CCPoint start = touch->locationInView();
start = CCDirector::sharedDirector()->convertToGL(start); start = CCDirector::sharedDirector()->convertToGL(start);
CCPoint end = touch->previousLocationInView(touch->view()); CCPoint end = touch->previousLocationInView();
// begin drawing to the render texture // begin drawing to the render texture
m_pTarget->begin(); m_pTarget->begin();
@ -484,7 +484,7 @@ void RenderTextureZbuffer::ccTouchesBegan(cocos2d::CCSet *touches, cocos2d::CCEv
for (iter = touches->begin(); iter != touches->end(); ++iter) for (iter = touches->begin(); iter != touches->end(); ++iter)
{ {
touch = (CCTouch *)(*iter); touch = (CCTouch *)(*iter);
CCPoint location = touch->locationInView(touch->view()); CCPoint location = touch->locationInView();
location = CCDirector::sharedDirector()->convertToGL(location); location = CCDirector::sharedDirector()->convertToGL(location);
sp1->setPosition(location); sp1->setPosition(location);
@ -506,7 +506,7 @@ void RenderTextureZbuffer::ccTouchesMoved(CCSet* touches, CCEvent* event)
for (iter = touches->begin(); iter != touches->end(); ++iter) for (iter = touches->begin(); iter != touches->end(); ++iter)
{ {
touch = (CCTouch *)(*iter); touch = (CCTouch *)(*iter);
CCPoint location = touch->locationInView(touch->view()); CCPoint location = touch->locationInView();
location = CCDirector::sharedDirector()->convertToGL(location); location = CCDirector::sharedDirector()->convertToGL(location);
sp1->setPosition(location); sp1->setPosition(location);

View File

@ -1 +1 @@
6595f171c5456c76d377700a26ffff70d835c18d ea35cf50d699b85c3eb96c756181f00f63c96d5b

View File

@ -203,7 +203,7 @@ void KeyboardNotificationLayer::keyboardWillShow(CCIMEKeyboardNotificationInfo&
bool KeyboardNotificationLayer::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent) bool KeyboardNotificationLayer::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
{ {
CCLOG("++++++++++++++++++++++++++++++++++++++++++++"); CCLOG("++++++++++++++++++++++++++++++++++++++++++++");
m_beginPos = pTouch->locationInView(pTouch->view()); m_beginPos = pTouch->locationInView();
m_beginPos = CCDirector::sharedDirector()->convertToGL(m_beginPos); m_beginPos = CCDirector::sharedDirector()->convertToGL(m_beginPos);
return true; return true;
} }
@ -215,7 +215,7 @@ void KeyboardNotificationLayer::ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent)
return; return;
} }
CCPoint endPos = pTouch->locationInView(pTouch->view()); CCPoint endPos = pTouch->locationInView();
endPos = CCDirector::sharedDirector()->convertToGL(endPos); endPos = CCDirector::sharedDirector()->convertToGL(endPos);
float delta = 5.0f; float delta = 5.0f;

View File

@ -1363,8 +1363,8 @@ void TileDemo::ccTouchCancelled(CCTouch* touch, CCEvent* event)
void TileDemo::ccTouchMoved(CCTouch* touch, CCEvent* event) void TileDemo::ccTouchMoved(CCTouch* touch, CCEvent* event)
{ {
CCPoint touchLocation = touch->locationInView( touch->view() ); CCPoint touchLocation = touch->locationInView();
CCPoint prevLocation = touch->previousLocationInView( touch->view() ); CCPoint prevLocation = touch->previousLocationInView();
touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation ); touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation );
prevLocation = CCDirector::sharedDirector()->convertToGL( prevLocation ); prevLocation = CCDirector::sharedDirector()->convertToGL( prevLocation );

View File

@ -70,7 +70,7 @@ void Paddle::ccTouchMoved(CCTouch* touch, CCEvent* event)
CCAssert(m_state == kPaddleStateGrabbed, L"Paddle - Unexpected state!"); CCAssert(m_state == kPaddleStateGrabbed, L"Paddle - Unexpected state!");
CCPoint touchPoint = touch->locationInView( touch->view() ); CCPoint touchPoint = touch->locationInView();
touchPoint = CCDirector::sharedDirector()->convertToGL( touchPoint ); touchPoint = CCDirector::sharedDirector()->convertToGL( touchPoint );
setPosition( CCPointMake(touchPoint.x, getPosition().y) ); setPosition( CCPointMake(touchPoint.x, getPosition().y) );

View File

@ -191,7 +191,7 @@ void TestController::ccTouchesBegan(CCSet *pTouches, CCEvent *pEvent)
CCSetIterator it = pTouches->begin(); CCSetIterator it = pTouches->begin();
CCTouch* touch = (CCTouch*)(*it); CCTouch* touch = (CCTouch*)(*it);
m_tBeginPos = touch->locationInView( touch->view() ); m_tBeginPos = touch->locationInView();
m_tBeginPos = CCDirector::sharedDirector()->convertToGL( m_tBeginPos ); m_tBeginPos = CCDirector::sharedDirector()->convertToGL( m_tBeginPos );
} }
@ -200,7 +200,7 @@ void TestController::ccTouchesMoved(CCSet *pTouches, CCEvent *pEvent)
CCSetIterator it = pTouches->begin(); CCSetIterator it = pTouches->begin();
CCTouch* touch = (CCTouch*)(*it); CCTouch* touch = (CCTouch*)(*it);
CCPoint touchLocation = touch->locationInView( touch->view() ); CCPoint touchLocation = touch->locationInView();
touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation ); touchLocation = CCDirector::sharedDirector()->convertToGL( touchLocation );
float nMoveY = touchLocation.y - m_tBeginPos.y; float nMoveY = touchLocation.y - m_tBeginPos.y;