示例#1
0
        public virtual bool init()
        {
            this.m_bDirty = this.m_bRecursiveDirty = false;
            this.useSelfRender();
            this.m_bOpacityModifyRGB        = true;
            this.m_nOpacity                 = 0xff;
            this.m_sColor                   = new ccColor3B(0xff, 0xff, 0xff);
            this.m_sColorUnmodified         = new ccColor3B(0xff, 0xff, 0xff);
            this.m_sBlendFunc               = new ccBlendFunc();
            this.m_sBlendFunc.src           = ccMacros.CC_BLEND_SRC;
            this.m_sBlendFunc.dst           = ccMacros.CC_BLEND_DST;
            this.Texture                    = null;
            this.m_sQuad                    = new ccV3F_C4B_T2F_Quad();
            this.m_bFlipX                   = this.m_bFlipY = false;
            this.anchorPoint                = CCPointExtension.ccp(0.5f, 0.5f);
            this.m_obOffsetPositionInPixels = new CCPoint();
            this.m_eHonorParentTransform    = ccHonorParentTransform.CC_HONOR_PARENT_TRANSFORM_ALL;
            this.m_bHasChildren             = false;
            ccColor4B colorb = new ccColor4B(0xff, 0xff, 0xff, 0xff);

            this.m_sQuad.bl.colors = colorb;
            this.m_sQuad.br.colors = colorb;
            this.m_sQuad.tl.colors = colorb;
            this.m_sQuad.tr.colors = colorb;
            this.setTextureRectInPixels(new CCRect(), false, new CCSize());
            return(true);
        }
示例#2
0
 public override void update(float dt)
 {
     if (this.m_pTarget != null)
     {
         this.m_pTarget.position = CCPointExtension.ccp(this.m_startPosition.x + this.m_delta.x * dt, this.m_startPosition.y + this.m_delta.y * dt);
     }
 }
示例#3
0
 public override void Update(float dt)
 {
     if (Target != null)
     {
         Target.Position = CCPointExtension.ccp(m_startPosition.X + m_delta.X * dt,
                                                m_startPosition.Y + m_delta.Y * dt);
     }
 }
示例#4
0
        public static CCPoint ccpRotateByAngle(CCPoint v, CCPoint pivot, float angle)
        {
            CCPoint cCPoint = CCPointExtension.ccpSub(v, pivot);
            float   single  = (float)Math.Cos((double)angle);
            float   single1 = (float)Math.Sin((double)angle);
            float   single2 = cCPoint.x;

            cCPoint = CCPointExtension.ccp(single2 * single - cCPoint.y * single1 + pivot.x, single2 * single1 + cCPoint.y * single + pivot.y);
            return(cCPoint);
        }
示例#5
0
 public override void update(float dt)
 {
     if (this.m_pTarget != null)
     {
         float single  = dt * (float)((float)this.m_nJumps) % 1f;
         float mHeight = this.m_height * 4f * single * (1f - single);
         mHeight = mHeight + this.m_delta.y * dt;
         float mDelta = this.m_delta.x * dt;
         this.m_pTarget.position = CCPointExtension.ccp(this.m_startPosition.x + mDelta, this.m_startPosition.y + mHeight);
     }
 }
示例#6
0
 public override void Update(float dt)
 {
     if (Target != null)
     {
         // Is % equal to fmodf()???
         float frac = (dt * m_nJumps) % 1.0f;
         float y    = m_height * 4 * frac * (1 - frac);
         y += m_delta.Y * dt;
         float x = m_delta.X * dt;
         Target.Position = CCPointExtension.ccp(m_startPosition.X + x, m_startPosition.Y + y);
     }
 }
示例#7
0
        public virtual bool init()
        {
            m_bDirty = m_bRecursiveDirty = false;

            // by default use "Self Render".
            // if the sprite is added to an batchnode, then it will automatically switch to "SpriteSheet Render"
            useSelfRender();

            m_bOpacityModifyRGB = true;
            m_nOpacity          = 255;
            m_sColor            = new ccColor3B(255, 255, 255);
            m_sColorUnmodified  = new ccColor3B(255, 255, 255);

            m_sBlendFunc     = new ccBlendFunc();
            m_sBlendFunc.src = ccMacros.CC_BLEND_SRC;
            m_sBlendFunc.dst = ccMacros.CC_BLEND_DST;


            // update texture (calls updateBlendFunc)
            Texture = null;

            // clean the Quad
            m_sQuad = new ccV3F_C4B_T2F_Quad();

            m_bFlipX = m_bFlipY = false;

            // default transform anchor: center
            anchorPoint = (CCPointExtension.ccp(0.5f, 0.5f));

            // zwoptex default values
            m_obOffsetPositionInPixels = new CCPoint();

            m_eHonorParentTransform = ccHonorParentTransform.CC_HONOR_PARENT_TRANSFORM_ALL;
            m_bHasChildren          = false;

            // Atlas: Color
            ccColor4B tmpColor = new ccColor4B(255, 255, 255, 255);

            m_sQuad.bl.colors = tmpColor;
            m_sQuad.br.colors = tmpColor;
            m_sQuad.tl.colors = tmpColor;
            m_sQuad.tr.colors = tmpColor;

            // Atlas: Vertex

            // updated in "useSelfRender"

            // Atlas: TexCoords

            setTextureRectInPixels(new CCRect(), false, new CCSize());

            return(true);
        }
示例#8
0
 public override void step(float dt)
 {
     if (this.m_bBoundarySet)
     {
         if (!this.m_bBoundaryFullyCovered)
         {
             CCPoint point = CCPointExtension.ccpSub(this.m_obHalfScreenSize, this.m_pobFollowedNode.position);
             base.m_pTarget.position = CCPointExtension.ccp(CCPointExtension.clampf(point.x, this.m_fLeftBoundary, this.m_fRightBoundary), CCPointExtension.clampf(point.y, this.m_fBottomBoundary, this.m_fTopBoundary));
         }
     }
     else
     {
         base.m_pTarget.position = CCPointExtension.ccpSub(this.m_obHalfScreenSize, this.m_pobFollowedNode.position);
     }
 }
示例#9
0
        public override void update(float dt)
        {
            if (m_pTarget != null)
            {
                float xa = 0;
                float xb = m_sConfig.controlPoint_1.x;
                float xc = m_sConfig.controlPoint_2.x;
                float xd = m_sConfig.endPosition.x;

                float ya = 0;
                float yb = m_sConfig.controlPoint_1.y;
                float yc = m_sConfig.controlPoint_2.y;
                float yd = m_sConfig.endPosition.y;

                float x = bezierat(xa, xb, xc, xd, dt);
                float y = bezierat(ya, yb, yc, yd, dt);
                m_pTarget.position = CCPointExtension.ccpAdd(m_startPosition, CCPointExtension.ccp(x, y));
            }
        }
示例#10
0
        public override void step(float dt)
        {
            if (m_bBoundarySet)
            {
                // whole map fits inside a single screen, no need to modify the position - unless map boundaries are increased
                if (m_bBoundaryFullyCovered)
                {
                    return;
                }

                CCPoint tempPos = CCPointExtension.ccpSub(m_obHalfScreenSize, m_pobFollowedNode.position);
                m_pTarget.position = CCPointExtension.ccp(CCPointExtension.clampf(tempPos.x, m_fLeftBoundary, m_fRightBoundary),
                                                          CCPointExtension.clampf(tempPos.y, m_fBottomBoundary, m_fTopBoundary));
            }
            else
            {
                m_pTarget.position = CCPointExtension.ccpSub(m_obHalfScreenSize, m_pobFollowedNode.position);
            }
        }
示例#11
0
 public override CCFiniteTimeAction Reverse()
 {
     return(CCMoveBy.actionWithDuration(Duration, CCPointExtension.ccp(-m_delta.X, -m_delta.Y)));
 }
示例#12
0
 public override CCFiniteTimeAction Reverse()
 {
     return(CCJumpBy.actionWithDuration(Duration, CCPointExtension.ccp(-m_delta.X, -m_delta.Y), m_height, m_nJumps));
 }
示例#13
0
 public static CCPoint ccpAdd(CCPoint v1, CCPoint v2)
 {
     return(CCPointExtension.ccp(v1.x + v2.x, v1.y + v2.y));
 }
示例#14
0
 public static CCPoint ccpClamp(CCPoint p, CCPoint from, CCPoint to)
 {
     return(CCPointExtension.ccp(CCPointExtension.clampf(p.x, from.x, to.x), CCPointExtension.clampf(p.y, from.y, to.y)));
 }
示例#15
0
 public static CCPoint ccpMult(CCPoint v, float s)
 {
     return(CCPointExtension.ccp(v.x * s, v.y * s));
 }
示例#16
0
 public static CCPoint ccpRPerp(CCPoint v)
 {
     return(CCPointExtension.ccp(v.y, -v.x));
 }
示例#17
0
 public CCLayer()
 {
     AnchorPoint           = CCPointExtension.ccp(0.5f, 0.5f);
     IsRelativeAnchorPoint = false;
 }
示例#18
0
 public CCScene()
 {
     isRelativeAnchorPoint = false;
     anchorPoint           = CCPointExtension.ccp(0.5f, 0.5f);
     m_eSceneType          = ccSceneFlag.ccNormalScene;
 }
示例#19
0
 public static CCPoint ccpSub(CCPoint v1, CCPoint v2)
 {
     return(CCPointExtension.ccp(v1.x - v2.x, v1.y - v2.y));
 }
示例#20
0
 public static CCPoint ccpForAngle(float a)
 {
     return(CCPointExtension.ccp((float)Math.Cos((double)a), (float)Math.Sin((double)a)));
 }
示例#21
0
 public static CCPoint ccpCompOp(CCPoint p, CCPointExtension.ccpCompOpDelegate del)
 {
     return(CCPointExtension.ccp(del(p.x), del(p.y)));
 }
示例#22
0
 public static CCPoint ccpCompMult(CCPoint a, CCPoint b)
 {
     return(CCPointExtension.ccp(a.x * b.x, a.y * b.y));
 }
示例#23
0
 public override void StartWithTarget(Node target)
 {
     base.StartWithTarget(target);
     m_delta = CCPointExtension.ccp(m_delta.X - m_startPosition.X, m_delta.Y - m_startPosition.Y);
 }
示例#24
0
 public static CCPoint ccpNeg(CCPoint v)
 {
     return(CCPointExtension.ccp(-v.x, -v.y));
 }
示例#25
0
 public override void update(float dt)
 {
     if (this.m_pTarget != null)
     {
         float single         = 0f;
         float controlPoint1  = this.m_sConfig.controlPoint_1.x;
         float controlPoint2  = this.m_sConfig.controlPoint_2.x;
         float mSConfig       = this.m_sConfig.endPosition.x;
         float single1        = 0f;
         float controlPoint11 = this.m_sConfig.controlPoint_1.y;
         float controlPoint21 = this.m_sConfig.controlPoint_2.y;
         float mSConfig1      = this.m_sConfig.endPosition.y;
         float single2        = this.bezierat(single, controlPoint1, controlPoint2, mSConfig, dt);
         float single3        = this.bezierat(single1, controlPoint11, controlPoint21, mSConfig1, dt);
         this.m_pTarget.position = CCPointExtension.ccpAdd(this.m_startPosition, CCPointExtension.ccp(single2, single3));
     }
 }
示例#26
0
 public CCLayer()
 {
     this.anchorPoint           = CCPointExtension.ccp(0.5f, 0.5f);
     this.isRelativeAnchorPoint = false;
 }
示例#27
0
 public static CCPoint ccpFromSize(CCSize s)
 {
     return(CCPointExtension.ccp(s.width, s.height));
 }
示例#28
0
 public static CCPoint ccpUnrotate(CCPoint v1, CCPoint v2)
 {
     return(CCPointExtension.ccp(v1.x * v2.x + v1.y * v2.y, v1.y * v2.x - v1.x * v2.y));
 }
示例#29
0
 public override CCFiniteTimeAction reverse()
 {
     return(CCJumpBy.actionWithDuration(this.m_fDuration, CCPointExtension.ccp(-this.m_delta.x, -this.m_delta.y), this.m_height, this.m_nJumps));
 }
示例#30
0
 public override CCFiniteTimeAction reverse()
 {
     return(CCMoveBy.actionWithDuration(this.m_fDuration, CCPointExtension.ccp(-this.m_delta.x, -this.m_delta.y)));
 }