diff --git a/cocos2dx/menu_nodes/CCMenuItem.cpp b/cocos2dx/menu_nodes/CCMenuItem.cpp index c9ed91e8ce..f61d398f56 100644 --- a/cocos2dx/menu_nodes/CCMenuItem.cpp +++ b/cocos2dx/menu_nodes/CCMenuItem.cpp @@ -378,9 +378,10 @@ namespace cocos2d{ { assert(normalSprite != NULL); CCMenuItem::initWithTarget(target, selector); - this->m_pNormalImage = normalSprite; CCX_SAFE_RETAIN(normalSprite); - this->m_pSelectedImage = selectedSprite; CCX_SAFE_RETAIN(selectedSprite); - this->m_pDisabledImage = disabledSprite; CCX_SAFE_RETAIN(disabledSprite); + setNormalImage(normalSprite); + setSelectedImage(selectedSprite); + setDisabledImage(disabledSprite); + this->setContentSize(m_pNormalImage->getContentSize()); return true; } diff --git a/cocos2dx/platform/CCDirector_mobile.cpp b/cocos2dx/platform/CCDirector_mobile.cpp index c4aa2efcd5..3a346c2fb9 100644 --- a/cocos2dx/platform/CCDirector_mobile.cpp +++ b/cocos2dx/platform/CCDirector_mobile.cpp @@ -284,11 +284,10 @@ void CCDirector::setOpenGLView(CC_GLVIEW *pobOpenGLView) delete m_pobOpenGLView; // [openGLView_ release] m_pobOpenGLView = pobOpenGLView; - setGLDefaultValues(); - // set size m_obWinSizeInPoints = CCNSSizeToCGSize(m_pobOpenGLView->getSize()); m_obWinSizeInPixels = CGSizeMake(m_obWinSizeInPoints.width * m_fContentScaleFactor, m_obWinSizeInPoints.height * m_fContentScaleFactor); + setGLDefaultValues(); if (m_fContentScaleFactor != 1) { @@ -297,7 +296,7 @@ void CCDirector::setOpenGLView(CC_GLVIEW *pobOpenGLView) CCTouchDispatcher *pTouchDispatcher = CCTouchDispatcher::sharedDispatcher(); m_pobOpenGLView->setTouchDelegate(pTouchDispatcher); - pTouchDispatcher->setDispatchEvents(true); + pTouchDispatcher->setDispatchEvents(true); } } diff --git a/cocos2dx/platform/CCNode_mobile.cpp b/cocos2dx/platform/CCNode_mobile.cpp index 4b4b90087b..6e88e18470 100644 --- a/cocos2dx/platform/CCNode_mobile.cpp +++ b/cocos2dx/platform/CCNode_mobile.cpp @@ -223,11 +223,11 @@ void CCNode::setPosition(CGPoint newPosition) m_tPosition = newPosition; if (CC_CONTENT_SCALE_FACTOR() == 1) { - m_tAnchorPointInPixels = m_tPosition; + m_tPositionInPixels = m_tPosition; } else { - m_tAnchorPointInPixels = ccpMult(newPosition, CC_CONTENT_SCALE_FACTOR()); + m_tPositionInPixels = ccpMult(newPosition, CC_CONTENT_SCALE_FACTOR()); } m_bIsTransformDirty = m_bIsInverseDirty = true; diff --git a/cocos2dx/platform/mac/CCNode_mac.cpp b/cocos2dx/platform/mac/CCNode_mac.cpp index 80ad97c38a..65fce706bc 100644 --- a/cocos2dx/platform/mac/CCNode_mac.cpp +++ b/cocos2dx/platform/mac/CCNode_mac.cpp @@ -224,11 +224,11 @@ void CCNode::setPosition(CGPoint newPosition) m_tPosition = newPosition; if (CC_CONTENT_SCALE_FACTOR() == 1) { - m_tAnchorPointInPixels = m_tPosition + m_tPositionInPixels = m_tPosition } else { - m_tAnchorPointInPixels = ccpMult(newPosition, CC_CONTENT_SCALE_FACTOR()); + m_tPositionInPixels = ccpMult(newPosition, CC_CONTENT_SCALE_FACTOR()); } m_bIsTransformDirty = m_bIsInverseDirty = true; @@ -239,11 +239,11 @@ void CCNode::setPosition(CGPoint newPosition) void CCNode::setPositionInPixels(CGPoint newPosition) { - m_tAnchorPointInPixels = newPosition; + m_tPositionInPixels = newPosition; if ( CC_CONTENT_SCALE_FACTOR() == 1) { - m_tPosition = m_tAnchorPointInPixels; + m_tPosition = m_tPositionInPixels; } else { @@ -801,9 +801,9 @@ void CCNode::transform() glTranslatef( RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.y), 0); if (m_tAnchorPointInPixels.x != 0 || m_tAnchorPointInPixels.y != 0) - glTranslatef( RENDER_IN_SUBPIXEL(m_tPositionInPixels.x + m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(m_tPosition.y + m_tAnchorPointInPixels.y), m_fVertexZ); + glTranslatef( RENDER_IN_SUBPIXEL(m_tPositionInPixels.x + m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(m_tPositionInPixels.y + m_tAnchorPointInPixels.y), m_fVertexZ); else if ( m_tPositionInPixels.x !=0 || m_tPositionInPixels.y !=0 || m_fVertexZ != 0) - glTranslatef( RENDER_IN_SUBPIXEL(m_tPosition.x), RENDER_IN_SUBPIXEL(m_tPosition.y), m_fVertexZ ); + glTranslatef( RENDER_IN_SUBPIXEL(m_tPositionInPixels.x), RENDER_IN_SUBPIXEL(m_tPositionInPixels.y), m_fVertexZ ); // rotate if (m_fRotation != 0.0f )