Fix bugs.Run HelloWorld successful.

This commit is contained in:
natural-law 2011-01-05 11:24:52 +08:00
parent 25e9721678
commit 1b37dd27ad
4 changed files with 14 additions and 14 deletions

View File

@ -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;
}

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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 )