mirror of https://github.com/axmolengine/axmol.git
Fix bugs.Run HelloWorld successful.
This commit is contained in:
parent
25e9721678
commit
1b37dd27ad
|
@ -378,9 +378,10 @@ namespace cocos2d{
|
||||||
{
|
{
|
||||||
assert(normalSprite != NULL);
|
assert(normalSprite != NULL);
|
||||||
CCMenuItem::initWithTarget(target, selector);
|
CCMenuItem::initWithTarget(target, selector);
|
||||||
this->m_pNormalImage = normalSprite; CCX_SAFE_RETAIN(normalSprite);
|
setNormalImage(normalSprite);
|
||||||
this->m_pSelectedImage = selectedSprite; CCX_SAFE_RETAIN(selectedSprite);
|
setSelectedImage(selectedSprite);
|
||||||
this->m_pDisabledImage = disabledSprite; CCX_SAFE_RETAIN(disabledSprite);
|
setDisabledImage(disabledSprite);
|
||||||
|
|
||||||
this->setContentSize(m_pNormalImage->getContentSize());
|
this->setContentSize(m_pNormalImage->getContentSize());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,11 +284,10 @@ void CCDirector::setOpenGLView(CC_GLVIEW *pobOpenGLView)
|
||||||
delete m_pobOpenGLView; // [openGLView_ release]
|
delete m_pobOpenGLView; // [openGLView_ release]
|
||||||
m_pobOpenGLView = pobOpenGLView;
|
m_pobOpenGLView = pobOpenGLView;
|
||||||
|
|
||||||
setGLDefaultValues();
|
|
||||||
|
|
||||||
// set size
|
// set size
|
||||||
m_obWinSizeInPoints = CCNSSizeToCGSize(m_pobOpenGLView->getSize());
|
m_obWinSizeInPoints = CCNSSizeToCGSize(m_pobOpenGLView->getSize());
|
||||||
m_obWinSizeInPixels = CGSizeMake(m_obWinSizeInPoints.width * m_fContentScaleFactor, m_obWinSizeInPoints.height * m_fContentScaleFactor);
|
m_obWinSizeInPixels = CGSizeMake(m_obWinSizeInPoints.width * m_fContentScaleFactor, m_obWinSizeInPoints.height * m_fContentScaleFactor);
|
||||||
|
setGLDefaultValues();
|
||||||
|
|
||||||
if (m_fContentScaleFactor != 1)
|
if (m_fContentScaleFactor != 1)
|
||||||
{
|
{
|
||||||
|
@ -297,7 +296,7 @@ void CCDirector::setOpenGLView(CC_GLVIEW *pobOpenGLView)
|
||||||
|
|
||||||
CCTouchDispatcher *pTouchDispatcher = CCTouchDispatcher::sharedDispatcher();
|
CCTouchDispatcher *pTouchDispatcher = CCTouchDispatcher::sharedDispatcher();
|
||||||
m_pobOpenGLView->setTouchDelegate(pTouchDispatcher);
|
m_pobOpenGLView->setTouchDelegate(pTouchDispatcher);
|
||||||
pTouchDispatcher->setDispatchEvents(true);
|
pTouchDispatcher->setDispatchEvents(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -223,11 +223,11 @@ void CCNode::setPosition(CGPoint newPosition)
|
||||||
m_tPosition = newPosition;
|
m_tPosition = newPosition;
|
||||||
if (CC_CONTENT_SCALE_FACTOR() == 1)
|
if (CC_CONTENT_SCALE_FACTOR() == 1)
|
||||||
{
|
{
|
||||||
m_tAnchorPointInPixels = m_tPosition;
|
m_tPositionInPixels = m_tPosition;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_tAnchorPointInPixels = ccpMult(newPosition, CC_CONTENT_SCALE_FACTOR());
|
m_tPositionInPixels = ccpMult(newPosition, CC_CONTENT_SCALE_FACTOR());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bIsTransformDirty = m_bIsInverseDirty = true;
|
m_bIsTransformDirty = m_bIsInverseDirty = true;
|
||||||
|
|
|
@ -224,11 +224,11 @@ void CCNode::setPosition(CGPoint newPosition)
|
||||||
m_tPosition = newPosition;
|
m_tPosition = newPosition;
|
||||||
if (CC_CONTENT_SCALE_FACTOR() == 1)
|
if (CC_CONTENT_SCALE_FACTOR() == 1)
|
||||||
{
|
{
|
||||||
m_tAnchorPointInPixels = m_tPosition
|
m_tPositionInPixels = m_tPosition
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_tAnchorPointInPixels = ccpMult(newPosition, CC_CONTENT_SCALE_FACTOR());
|
m_tPositionInPixels = ccpMult(newPosition, CC_CONTENT_SCALE_FACTOR());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bIsTransformDirty = m_bIsInverseDirty = true;
|
m_bIsTransformDirty = m_bIsInverseDirty = true;
|
||||||
|
@ -239,11 +239,11 @@ void CCNode::setPosition(CGPoint newPosition)
|
||||||
|
|
||||||
void CCNode::setPositionInPixels(CGPoint newPosition)
|
void CCNode::setPositionInPixels(CGPoint newPosition)
|
||||||
{
|
{
|
||||||
m_tAnchorPointInPixels = newPosition;
|
m_tPositionInPixels = newPosition;
|
||||||
|
|
||||||
if ( CC_CONTENT_SCALE_FACTOR() == 1)
|
if ( CC_CONTENT_SCALE_FACTOR() == 1)
|
||||||
{
|
{
|
||||||
m_tPosition = m_tAnchorPointInPixels;
|
m_tPosition = m_tPositionInPixels;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -801,9 +801,9 @@ void CCNode::transform()
|
||||||
glTranslatef( RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.y), 0);
|
glTranslatef( RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.x), RENDER_IN_SUBPIXEL(-m_tAnchorPointInPixels.y), 0);
|
||||||
|
|
||||||
if (m_tAnchorPointInPixels.x != 0 || 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)
|
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
|
// rotate
|
||||||
if (m_fRotation != 0.0f )
|
if (m_fRotation != 0.0f )
|
||||||
|
|
Loading…
Reference in New Issue