/** Sets a new CCSpriteFrame as particle. * WARNING: this method is experimental. Use setTexture:withRect instead. * @since v0.99.4 */ public void setDisplayFrame(CCSpriteFrame spriteFrame) { Debug.Assert(CCPoint.CCPointEqualToPoint(spriteFrame.OffsetInPixels, new CCPoint(0, 0)), "QuadParticle only supports SpriteFrames with no offsets"); // update texture before updating texture rect if (null == this.Texture || spriteFrame.Texture.Name != this.Texture.Name) { this.Texture = spriteFrame.Texture; } }
public void setPosition(CCPoint pos) { if (!CCPoint.CCPointEqualToPoint(pos, this.m_position)) { this.m_position = pos; this.m_positionInPixels.x = pos.x * CCDirector.sharedDirector().ContentScaleFactor; this.m_positionInPixels.y = pos.y * CCDirector.sharedDirector().ContentScaleFactor; this.m_bDirty = true; } }
public static bool CCRectEqualToRect(CCRect rect1, CCRect rect2) { if (rect1 == null || rect2 == null) { return(false); } if (!CCPoint.CCPointEqualToPoint(rect1.origin, rect2.origin)) { return(false); } return(CCSize.CCSizeEqualToSize(rect1.size, rect2.size)); }
public static bool CCRectEqualToRect(CCRect rect1, CCRect rect2) { Debug.Assert((rect1 != null) && (rect2 != null)); if ((rect1 == null) || (rect2 == null)) { return(false); } else { return(CCPoint.CCPointEqualToPoint(rect1.origin, rect2.origin) && (CCSize.CCSizeEqualToSize(rect1.size, rect2.size))); } }
public virtual new void visit() { CCPoint cCPoint = this.absolutePosition(); if (!CCPoint.CCPointEqualToPoint(cCPoint, this.m_tLastPosition)) { for (int i = 0; i < this.m_pParallaxArray.Count; i++) { CCPointObject item = this.m_pParallaxArray[i]; float ratio = -cCPoint.x + cCPoint.x * item.Ratio.x + item.Offset.x; float single = -cCPoint.y + cCPoint.y * item.Ratio.y + item.Offset.y; item.Child.position = new CCPoint(ratio, single); } this.m_tLastPosition = cCPoint; } base.visit(); }
public virtual void visit() { // CCPoint pos = position_; // CCPoint pos = [self convertToWorldSpace:CCPointZero]; CCPoint pos = this.absolutePosition(); if (!CCPoint.CCPointEqualToPoint(pos, m_tLastPosition)) { for (int i = 0; i < m_pParallaxArray.Count; i++) { CCPointObject point = (CCPointObject)(m_pParallaxArray[i]); float x = -pos.x + pos.x * point.Ratio.x + point.Offset.x; float y = -pos.y + pos.y * point.Ratio.y + point.Offset.y; point.Child.position = new CCPoint(x, y); } m_tLastPosition = pos; } base.visit(); }
private CCPoint calculateLayerOffset(CCPoint pos) { CCPoint ret = new CCPoint(0, 0); switch (m_uLayerOrientation) { case CCTMXOrientatio.CCTMXOrientationOrtho: ret = new CCPoint(pos.x * m_tMapTileSize.width, -pos.y * m_tMapTileSize.height); break; case CCTMXOrientatio.CCTMXOrientationHex: Debug.Assert(CCPoint.CCPointEqualToPoint(pos, new CCPoint(0, 0)), "offset for hexagonal map not implemented yet"); break; case CCTMXOrientatio.CCTMXOrientationIso: ret = new CCPoint((m_tMapTileSize.width / 2) * (pos.x - pos.y), (m_tMapTileSize.height / 2) * (-pos.x - pos.y)); break; } return(ret); }