zoukankan      html  css  js  c++  java
  • ccnode

    The most popular CCNodes are: CCSceneCCLayerCCSpriteCCMenu.

    m_bIgnoreAnchorPointForPosition这个值在node中被初始化为false,也就是不忽略(就要考虑)锚点,也就是说在你设置位置的时候必须考虑锚点。

    下面这个链接是关于锚点忽略锚点的比较详细的说明:

    http://blog.csdn.net/wayne5ning/article/details/8160506

    *******************************************************************************************************************

    /** The scale factor of the node. 1.0 is the default scale factor. It modifies the X and Y scale at the same time. */
    void setScale(float scale);

    *******************************************************************************************************************

    CCRect boundingBox(void);

    举个例子:

    bool ret = CCRect::CCRectContainsPoint(

    this->boundingBox() , this->getParent()->convertTouchToNodeSpace( pTouch ));

    这个例子的功能是来判定当前的触摸操作是否发生在自己的node对象上。其中pTouch是CCTouch对象的指针,包含了当前触摸事件发生点的坐标。

    CCRectContainsPoint这个函数用来判断一个点是否在一个矩形范围内。我们就想用这个函数来判断当前触摸操作的这个点是否在当前node的范围内。

    this->boundingBox() 方法获得了当前节点对象在父节点对象下的缩放之后的本地坐标大小,并且是用GL坐标系表示的。

    pTouch对象中的坐标是屏幕坐标系,所以必须转换到GL坐标系,再转换到父节点的本地坐标下。好在convertTouchToNodeSpace这个函数一次完成了这两个转换,可以参考该库的源码,其中有具体的计算过程。

    所有数据都转换到同一个坐标系下了以后,就可以通过CCRectContainsPoint函数完成最终的判定操作。

    *******************************************************************************************************************

    // actions

    Executes an action, and returns the action that is executed.
    The node becomes the action's target.

    这里动作只是简单的runaction()和stopaction()。

    schedule的四种重载函数也在这里声明。

    *******************************************************************************************************************

  • 相关阅读:
    史上最全的SpringMVC学习笔记
    bzoj4551 [Tjoi2016&Heoi2016]树
    bzoj1196 [HNOI2006]公路修建问题
    bzoj3573 [Hnoi2014]米特运输
    bzoj3527 [Zjoi2014]力
    bzoj4197 [Noi2015]寿司晚宴
    【国家集训队2012】tree(伍一鸣)
    bzoj2748 [HAOI2012]音量调节
    bzoj2049 [Sdoi2008]Cave 洞穴勘测
    bzoj3611 [Heoi2014]大工程
  • 原文地址:https://www.cnblogs.com/imoon/p/2844781.html
Copyright © 2011-2022 走看看