cocos2dx 3.2 ScrollView 2个bug(滚动方向相反和jump函数不能用),ListView变绿不显示

前端之家收集整理的这篇文章主要介绍了cocos2dx 3.2 ScrollView 2个bug(滚动方向相反和jump函数不能用),ListView变绿不显示前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

ScrollView

<1>

CC_SYNTHESIZE(bool,_bOpposite,BOpposite);  //jn
bool m_bIsChangeInnerContainerPos; // jn

<2>

_bOpposite = false;                    //jn
m_bIsChangeInnerContainerPos = false;  //jn
<3>

void ScrollView::onSizeChanged()
{
    //...    
    if(!m_bIsChangeInnerContainerPos){  //jn  判断是不是改过位置 改过的话就不要再onsize里面初始化位置   2015-5-18
        _innerContainer->setPosition(Vec2(0,_contentSize.height - _innerContainer->getContentSize().height));
    }
}
<4>

void ScrollView::jumpToDestination(const Vec2 &des)
{
    if(!_innerContainer->getPosition().equals(Vec2::ZERO)){  //jn新增  5-18
        m_bIsChangeInnerContainerPos = true;
    }
    //...
}
<5>

void ScrollView::handleMoveLogic(Touch *touch)
{
    Vec2 delta = -touch->getLocation() + touch->getPrevIoUsLocation();
    switch (_direction)
    {
        case Direction::VERTICAL: // vertical
        {
            if(_bOpposite){
                scrollChildren(0.0f,-delta.y);  //jn 原来是:scrollChildren(0.0f,delta.y); 改动scrollview滚动方向,原来相反了。贾楠修改。
            }else{
                scrollChildren(0.0f,delta.y);  //jn 原来是:scrollChildren(0.0f,原来相反了。贾楠修改。
            }
            
            break;
        }
        case Direction::HORIZONTAL: // horizontal
        {
            scrollChildren(delta.x,0.0f);
            break;
        }
        case Direction::BOTH: // both
        {
            scrollChildren(delta.x,delta.y);
            break;
        }
        default:
            break;
    }
}

ListView

<1>

public class AppActivity extends Cocos2dxActivity {
	
	//...
	public Cocos2dxGLSurfaceView onCreateView(){
		
		Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
		glSurfaceView.setEGLConfigChooser(5,6,5,16,8);
		return glSurfaceView;
	}

猜你在找的Cocos2d-x相关文章