cocos2d-x CCTouch中的函数

来源:互联网 发布:便宜已备案域名出售 编辑:程序博客网 时间:2024/04/27 10:50
// returns the current touch location in screen coordinates 屏幕左上角为原点,向右为x轴,向下为y轴
CCPoint CCTouch::getLocationInView() const
    //获取屏幕坐标
    return m_point; 
}
              
// returns the current previous location in screen coordinates
CCPoint CCTouch::getPreviousLocationInView() const
    //获取上一次的屏幕坐标
    return m_prevPoint; 
}
              
// returns the current touch location in OpenGL coordinates 屏幕左下角为原点,向右为x轴,向上为y轴
CCPoint CCTouch::getLocation() const
    //获取在opengl坐标系中的坐标
    return CCDirector::sharedDirector()->convertToGL(m_point); 
}
              
// returns the previous touch location in OpenGL coordinates
CCPoint CCTouch::getPreviousLocation() const
    //获取上一次在opengl坐标系中的位置
    return CCDirector::sharedDirector()->convertToGL(m_prevPoint);  
}
              
// returns the delta position between the current location and the previous location in OpenGL coordinates
CCPoint CCTouch::getDelta() const
{     
    //返回当前和上次位置在opengl坐标系中差值
    return ccpSub(getLocation(), getPreviousLocation()); 
}

getStartLocation()

getStartLocationInView()