cocos2d CCScrollView 解析

本文详细介绍了Cocos2d-x中CCNode类的重要属性,并对比分析了其子类CCLayer和CCScene的特性差异,特别是针对ignoreAnchorPointForPosition属性及锚点设置的不同之处进行了探讨。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

CCNode 重要属性:

m_obAnchorPoint = CCPointZero  
m_obPosition = CCPointZero 

#"whole screen objects. like Scenes and Layers, should set m_bIgnoreAnchorPointForPosition to true"

m_bIgnoreAnchorPointForPosition = false
m_obContentSize = CCSizeZero

CCLayer 和 CCScene 继承与 CCNode
并更改了上述部分属性:

**CCLayer:**
 m_bIgnoreAnchorPointForPosition = true
 setAnchorPoint = ccp(0.5,0.5)
 m_obContentSize = winSize

#CCLayer加入了对外部事件的处理如触摸,重力,菜单按钮。
#默认CCLayer不处理外部事件
 m_bTouchEnabled(false),
 m_bAccelerometerEnabled(false),
 m_bKeypadEnabled(false),

##CCScene:##
 m_bIgnoreAnchorPointForPosition = true
 setAnchorPoint = ccp(0.5,0.5)
 m_obContentSize = winSize

CCScrollView 继承自 CCLayer ,则继承下来的属性又 锚点为m_obAnchorPoint = ccp(0.5 0.5) 并且ignoreAnchorPointForPosition = true

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值