public bool initWithTileFile(string tile, int tileWidth, int tileHeight, int itemsToRender) { this.m_uItemWidth = tileWidth; this.m_uItemHeight = tileHeight; this.m_cOpacity = 255; ccColor3B _ccColor3B = ccTypes.ccWHITE; ccColor3B _ccColor3B1 = _ccColor3B; this.m_tColorUnmodified = _ccColor3B; this.m_tColor = _ccColor3B1; this.m_bIsOpacityModifyRGB = true; this.m_tBlendFunc.src = ccMacros.CC_BLEND_SRC; this.m_tBlendFunc.dst = ccMacros.CC_BLEND_DST; this.m_pTextureAtlas = new CCTextureAtlas(); this.m_pTextureAtlas.initWithFile(tile, itemsToRender); if (this.m_pTextureAtlas == null) { CCLog.Log("cocos2d: Could not initialize CCAtlasNode. Invalid Texture."); return(false); } this.updateBlendFunc(); this.updateOpacityModifyRGB(); this.calculateMaxItems(); this.m_uQuadsToDraw = itemsToRender; return(true); }
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); }
public ccColor4B(ccColor3B c3) { this.r = c3.r; this.g = c3.g; this.b = c3.b; this.a = 255; }
public ccColor4B(ccColor3B c3) { r = c3.r; g = c3.g; b = c3.b; a = 255; }
public bool initWithFade(float fade, float minSeg, float stroke, ccColor3B color, CCTexture2D texture) { this.position = CCPoint.CCPointZero; this.anchorPoint = CCPoint.CCPointZero; this.isRelativeAnchorPoint = false; this.m_bStartingPositionInitialized = false; this.m_tPositionR = CCPoint.CCPointZero; this.m_bFastMode = true; this.m_fMinSeg = (minSeg == -1f ? stroke / 5f : minSeg); CCMotionStreak mFMinSeg = this; mFMinSeg.m_fMinSeg = mFMinSeg.m_fMinSeg * this.m_fMinSeg; this.m_fStroke = stroke; this.m_fFadeDelta = 1f / fade; this.m_uMaxPoints = (int)(fade * 60f) + 2; this.m_uNuPoints = 0; this.m_pPointState = new float[this.m_uMaxPoints]; this.m_pPointVertexes = new CCPoint[this.m_uMaxPoints]; this.m_pVertices = new ccVertex2F[this.m_uMaxPoints * 2]; this.m_pTexCoords = new ccTex2F[this.m_uMaxPoints * 2]; this.m_pColor = new ccColor4B[this.m_uMaxPoints * 2]; this.m_tBlendFunc.src = 770; this.m_tBlendFunc.dst = 771; this.Texture = texture; this.Color = color; CCMotionStreak cCMotionStreak = this; base.schedule(new SEL_SCHEDULE(cCMotionStreak.update)); return(true); }
protected void updateColor() { byte opacity = this.m_pSprite.Opacity; ccColor3B color = this.m_pSprite.Color; ccColor4B _ccColor4B = new ccColor4B() { r = color.r, g = color.g, b = color.b, a = opacity }; ccColor4B _ccColor4B1 = _ccColor4B; if (this.m_pSprite.Texture.HasPremultipliedAlpha) { ccColor4B _ccColor4B2 = _ccColor4B1; _ccColor4B2.r = (byte)(_ccColor4B2.r * (byte)(opacity / 255)); ccColor4B _ccColor4B3 = _ccColor4B1; _ccColor4B3.g = (byte)(_ccColor4B3.g * (byte)(opacity / 255)); ccColor4B _ccColor4B4 = _ccColor4B1; _ccColor4B4.b = (byte)(_ccColor4B4.b * (byte)(opacity / 255)); } if (this.m_pVertexData != null) { for (int i = 0; i < this.m_nVertexDataCount; i++) { this.m_pVertexData[i].colors = _ccColor4B1; } } }
/// <summary> /// initializes an CCAtlasNode with an Atlas file the width and height of each item and the quantity of items to render /// </summary> public bool initWithTileFile(string tile, int tileWidth, int tileHeight, int itemsToRender) { Debug.Assert(tile != null); m_uItemWidth = tileWidth; m_uItemHeight = tileHeight; m_cOpacity = 255; m_tColor = m_tColorUnmodified = ccTypes.ccWHITE; m_bIsOpacityModifyRGB = true; m_tBlendFunc.src = ccMacros.CC_BLEND_SRC; m_tBlendFunc.dst = ccMacros.CC_BLEND_DST; // double retain to avoid the autorelease pool // also, using: self.textureAtlas supports re-initialization without leaking this.m_pTextureAtlas = new CCTextureAtlas(); this.m_pTextureAtlas.initWithFile(tile, itemsToRender); if (m_pTextureAtlas == null) { CCLog.Log("cocos2d: Could not initialize CCAtlasNode. Invalid Texture."); return(false); } this.updateBlendFunc(); this.updateOpacityModifyRGB(); this.calculateMaxItems(); m_uQuadsToDraw = itemsToRender; return(true); }
public void tintWithColor(ccColor3B colors) { this.Color = colors; for (int i = 0; i < this.m_uNuPoints * 2; i++) { this.m_pColor[i] = new ccColor4B(colors); } }
public CCLayerColor() { m_cOpacity = 0; m_tColor = new ccColor3B(0, 0, 0); // default blend function m_tBlendFunc = new ccBlendFunc(); m_tBlendFunc.src = 1; m_tBlendFunc.dst = 0x0303; }
protected bool initWithLabel(CCNode label, SelectorProtocol target, SEL_MenuHandler selector) { base.initWithTarget(target, selector); this.m_fOriginalScale = 1f; this.m_tColorBackup = new ccColor3B(Microsoft.Xna.Framework.Color.White); this.DisabledColor = new ccColor3B(126, 126, 126); this.Label = label; return(true); }
public bool initWithFade(float fade, float minSeg, float stroke, ccColor3B color, string path) { if (path == null) { throw (new ArgumentNullException(path, "Path is required to create the texture2d.")); } CCTexture2D texture = CCTextureCache.sharedTextureCache().addImage(path); return initWithFade(fade, minSeg, stroke, color, texture); }
public static CCMotionStreak create(float fade, float minSeg, float stroke, ccColor3B color, CCTexture2D texture) { CCMotionStreak pRet = new CCMotionStreak(); if (pRet.initWithFade(fade, minSeg, stroke, color, texture)) { return pRet; } return null; }
public bool initWithDuration(float duration, byte red, byte green, byte blue) { if (!base.initWithDuration(duration)) { return(false); } this.m_to = new ccColor3B(red, green, blue); return(true); }
public static CCMotionStreak create(float fade, float minSeg, float stroke, ccColor3B color, string path) { CCMotionStreak cCMotionStreak = new CCMotionStreak(); if (cCMotionStreak.initWithFade(fade, minSeg, stroke, color, path)) { return(cCMotionStreak); } return(null); }
public void tintWithColor(ccColor3B colors) { Color = colors; for (int i = 0; i < m_uNuPoints * 2; i++) { m_pColor[i] = new ccColor4B(colors); // *((ccColor3B*) (m_pColorPointer+i*4)) = colors; } }
public override void startWithTarget(CCNode target) { base.startWithTarget(target); ICCRGBAProtocol mPTarget = this.m_pTarget as ICCRGBAProtocol; if (mPTarget != null) { this.m_from = mPTarget.Color; } }
public CCLayerColor() { this.m_cOpacity = 0; this.m_tColor = new ccColor3B(0, 0, 0); this.m_tBlendFunc = new ccBlendFunc() { src = 1, dst = 771 }; }
public bool initWithFade(float fade, float minSeg, float stroke, ccColor3B color, string path) { if (path == null) { throw (new ArgumentNullException(path, "Path is required to create the texture2d.")); } CCTexture2D texture = CCTextureCache.sharedTextureCache().addImage(path); return(initWithFade(fade, minSeg, stroke, color, texture)); }
public static CCMotionStreak create(float fade, float minSeg, float stroke, ccColor3B color, CCTexture2D texture) { CCMotionStreak pRet = new CCMotionStreak(); if (pRet.initWithFade(fade, minSeg, stroke, color, texture)) { return(pRet); } return(null); }
/// <summary> /// initializes the transition with a duration and with an RGB color /// </summary> /// <param name="t"></param> /// <param name="scene"></param> /// <param name="color"></param> /// <returns></returns> public virtual bool initWithDuration(float duration, CCScene scene, ccColor3B color) { if (base.initWithDuration(duration, scene)) { m_tColor.r = color.r; m_tColor.g = color.g; m_tColor.b = color.b; m_tColor.a = 0; } return true; }
/// <summary> /// initializes the transition with a duration and with an RGB color /// </summary> public virtual bool initWithDuration(float duration, CCScene scene, ccColor3B color) { if (base.initWithDuration(duration, scene)) { m_tColor = new ccColor4B(); m_tColor.r = color.r; m_tColor.g = color.g; m_tColor.b = color.b; m_tColor.a = 0; } return(true); }
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); }
static ccTypes() { ccTypes.ccWHITE = new ccColor3B(255, 255, 255); ccTypes.ccYELLOW = new ccColor3B(255, 255, 0); ccTypes.ccBLUE = new ccColor3B(0, 0, 255); ccTypes.ccGREEN = new ccColor3B(0, 255, 0); ccTypes.ccRED = new ccColor3B(255, 0, 0); ccTypes.ccMAGENTA = new ccColor3B(255, 0, 255); ccTypes.ccBLACK = new ccColor3B(0, 0, 0); ccTypes.ccORANGE = new ccColor3B(255, 127, 0); ccTypes.ccGRAY = new ccColor3B(166, 166, 166); }
public override void startWithTarget(CCNode target) { base.startWithTarget(target); ICCRGBAProtocol cCRGBAProtocol = target as ICCRGBAProtocol; if (cCRGBAProtocol != null) { ccColor3B color = cCRGBAProtocol.Color; this.m_fromR = color.r; this.m_fromG = color.g; this.m_fromB = color.b; } }
public virtual bool initWithColor(ccColor4B start, ccColor4B end, CCPoint v) { this.m_endColor = new ccColor3B() { r = end.r, g = end.g, b = end.b }; this.m_cEndOpacity = end.a; this.m_cStartOpacity = start.a; this.m_AlongVector = v; this.m_bCompressedInterpolation = true; return(base.initWithColor(new ccColor4B(start.r, start.g, start.b, 255))); }
public virtual bool initWithDuration(float duration, CCScene scene, ccColor3B color) { if (base.initWithDuration(duration, scene)) { this.m_tColor = new ccColor4B() { r = color.r, g = color.g, b = color.b, a = 0 }; } return(true); }
public virtual bool onTextFieldInsertText(CCTextFieldTTF pSender, string text, int nLen) { // if insert enter, treat as default to detach with ime if ("\n" == text) { return(false); } // if the textfield's char count more than m_nCharLimit, doesn't insert text anymore. if (pSender.CharCount >= m_nCharLimit) { return(true); } // create a insert text sprite and do some action CCLabelTTF label = CCLabelTTF.labelWithString(text, TextInputTestScene.FONT_NAME, TextInputTestScene.FONT_SIZE); this.addChild(label); ccColor3B color = new ccColor3B { r = 226, g = 121, b = 7 }; label.Color = color; // move the sprite from top to position CCPoint endPos = pSender.position; if (pSender.CharCount > 0) { endPos.x += pSender.contentSize.width / 2; } CCSize inputTextSize = label.contentSize; CCPoint beginPos = new CCPoint(endPos.x, CCDirector.sharedDirector().getWinSize().height - inputTextSize.height * 2); float duration = 0.5f; label.position = beginPos; label.scale = 8; CCAction seq = CCSequence.actions( CCSpawn.actions( CCMoveTo.actionWithDuration(duration, endPos), CCScaleTo.actionWithDuration(duration, 1), CCFadeOut.actionWithDuration(duration)), CCCallFuncN.actionWithTarget(this, callbackRemoveNodeWhenDidAction)); label.runAction(seq); return(false); }
public bool initWithString(string theString, string fntFile) { this.m_pConfiguration = CCLabelBMFont.FNTConfigLoadFile(fntFile); if (!base.initWithFile(this.m_pConfiguration.m_sAtlasName, theString.Length)) { return(false); } this.m_cOpacity = 255; this.m_tColor = new ccColor3B(255, 255, 255); this.m_tContentSize = new CCSize(0f, 0f); this.m_bIsOpacityModifyRGB = this.m_pobTextureAtlas.Texture.HasPremultipliedAlpha; this.anchorPoint = new CCPoint(0.5f, 0.5f); this.setString(theString); return(true); }
public override void draw() { if (this.m_pDelegate != null && this.m_pDelegate.onDraw(this)) { return; } if (this.m_pInputText.Length > 0) { this.cclabelttf.draw(); return; } ccColor3B _ccColor3B = new ccColor3B(); this.cclabelttf.draw(); }
private void calculateItemsToRender() { this.m_nItemsToRender = 0; for (int i = 0; i < this.m_pTGAInfo.width; i++) { for (int j = 0; j < this.m_pTGAInfo.height; j++) { ccColor3B _ccColor3B = new ccColor3B() { r = this.m_pTGAInfo.imageData[0], g = this.m_pTGAInfo.imageData[1], b = this.m_pTGAInfo.imageData[2] }; } } }
private void calculateItemsToRender() { Debug.Assert(m_pTGAInfo != null, "tgaInfo must be non-nil"); m_nItemsToRender = 0; for (int x = 0; x < m_pTGAInfo.width; x++) { for (int y = 0; y < m_pTGAInfo.height; y++) { ccColor3B ptr = new ccColor3B() { r = m_pTGAInfo.imageData[0], g = m_pTGAInfo.imageData[1], b = m_pTGAInfo.imageData[2] }; //ccColor3B value = ptr[x + y * m_pTGAInfo.width]; //if (value.r) //{ // ++m_nItemsToRender; //} } } }
/// <summary> /// init a bitmap font altas with an initial string and the FNT file /// </summary> public bool initWithString(string theString, string fntFile) { Debug.Assert(theString != null); //CC_SAFE_RELEASE(m_pConfiguration);// allow re-init m_pConfiguration = FNTConfigLoadFile(fntFile); Debug.Assert(m_pConfiguration != null, "Error creating config for LabelBMFont"); if (base.initWithFile(m_pConfiguration.m_sAtlasName, theString.Length)) { m_cOpacity = 255; m_tColor = new ccColor3B(255, 255, 255); m_tContentSize = new CCSize(0, 0); m_bIsOpacityModifyRGB = m_pobTextureAtlas.Texture.HasPremultipliedAlpha; anchorPoint = new CCPoint(0.5f, 0.5f); this.setString(theString); return(true); } return(false); }
public override void draw() { if (m_pDelegate != null && m_pDelegate.onDraw(this)) { return; } if (m_pInputText.Length > 0) { cclabelttf.draw(); return; } // draw placeholder ccColor3B color = new ccColor3B(); color = m_ColorSpaceHolder; cclabelttf.draw(); //color = color; }
/// <summary> /// creates the transition with a duration and with an RGB color /// Example: FadeTransition::transitionWithDuration(2, scene, ccc3(255,0,0); // red color /// </summary> public static CCTransitionFade transitionWithDuration(float duration, CCScene scene, ccColor3B color) { CCTransitionFade pTransition = new CCTransitionFade(); pTransition.initWithDuration(duration, scene, color); return pTransition; }
public ccColor3B(ccColor3B copy) { r = copy.r; g = copy.g; b = copy.b; }
/** Returns a ccColor4F from a ccColor3B. Alpha will be 1. @since v0.99.1 */ public static ccColor4F ccc4FFromccc3B(ccColor3B c) { ccColor4F c4 = new ccColor4F(c.r / 255.0f, c.g / 255.0f, c.b / 255.0f, 1.0f); return c4; }
public override void onEnter() { base.onEnter(); Color = new ccColor3B(0,0,0); removeChild(m_background, true); m_background = null; CCParticleSystemQuad system = new CCParticleSystemQuad(); system.initWithFile("Images/SpinningPeasPlist"); system.setTextureWithRect(CCTextureCache.sharedTextureCache().addImage("Images/particles"), new CCRect(0,0,32,32)); addChild(system, 10); m_emitter = system; m_nIndex = 0; schedule(updateQuads, 2.0f); }
/// <summary> /// initializes an CCAtlasNode with an Atlas file the width and height of each item and the quantity of items to render /// </summary> public bool initWithTileFile(string tile, int tileWidth, int tileHeight, int itemsToRender) { Debug.Assert(tile != null); m_uItemWidth = tileWidth; m_uItemHeight = tileHeight; m_cOpacity = 255; m_tColor = m_tColorUnmodified = ccTypes.ccWHITE; m_bIsOpacityModifyRGB = true; m_tBlendFunc.src = ccMacros.CC_BLEND_SRC; m_tBlendFunc.dst = ccMacros.CC_BLEND_DST; // double retain to avoid the autorelease pool // also, using: self.textureAtlas supports re-initialization without leaking this.m_pTextureAtlas = new CCTextureAtlas(); this.m_pTextureAtlas.initWithFile(tile, itemsToRender); if (m_pTextureAtlas == null) { Debug.WriteLine("cocos2d: Could not initialize CCAtlasNode. Invalid Texture."); return false; } this.updateBlendFunc(); this.updateOpacityModifyRGB(); this.calculateMaxItems(); m_uQuadsToDraw = itemsToRender; return true; }
public static CCMotionStreak streakWithFade(float fade, float minSeg, float stroke, ccColor3B color, string path) { return create(fade, minSeg, stroke, color, path); }
public static CCMotionStreak streakWithFade(float fade, float minSeg, float stroke, ccColor3B color, CCTexture2D texture) { return CCMotionStreak.create(fade, minSeg, stroke, color, texture); }
/// <summary> /// init a bitmap font altas with an initial string and the FNT file /// </summary> public bool initWithString(string theString, string fntFile) { Debug.Assert(theString != null); //CC_SAFE_RELEASE(m_pConfiguration);// allow re-init m_pConfiguration = FNTConfigLoadFile(fntFile); Debug.Assert(m_pConfiguration != null, "Error creating config for LabelBMFont"); if (base.initWithFile(m_pConfiguration.m_sAtlasName, theString.Length)) { m_cOpacity = 255; m_tColor = new ccColor3B(255, 255, 255); m_tContentSize = new CCSize(0, 0); m_bIsOpacityModifyRGB = m_pobTextureAtlas.Texture.HasPremultipliedAlpha; anchorPoint = new CCPoint(0.5f, 0.5f); this.setString(theString); return true; } return false; }
/// <summary> /// initializes a CCMenuItemLabel with a Label, target and selector /// </summary> protected bool initWithLabel(CCNode label, SelectorProtocol target, SEL_MenuHandler selector) { base.initWithTarget(target, selector); m_fOriginalScale = 1.0f; m_tColorBackup = new ccColor3B(Microsoft.Xna.Framework.Color.White); // ccWHITE; DisabledColor = new ccColor3B(126, 126, 126); this.Label = label; return true; }
public override void onEnter() { base.onEnter(); Color = new ccColor3B(0, 0, 0); removeChild(m_background, true); m_background = null; m_emitter = new CCParticleSystemQuad(); // string filename = "Images/" + m_title + ".plist"; string filename = "Images/" + m_title; m_emitter.initWithFile(filename); addChild(m_emitter, 10); m_emitter.IsBlendAdditive = true; setEmitterPosition(); }
private void updateAtlasValueAt(ccGridSize pos, ccColor3B value, int index) { }
/** sets a tile at position x,y. For the moment only channel R is used */ void setTile(ccColor3B tile, ccGridSize position) { }
public bool initWithFade(float fade, float minSeg, float stroke, ccColor3B color, CCTexture2D texture) { position = CCPoint.CCPointZero; anchorPoint = CCPoint.CCPointZero; isRelativeAnchorPoint = false; // ignoreAnchorPointForPosition(true); m_bStartingPositionInitialized = false; m_tPositionR = CCPoint.CCPointZero; m_bFastMode = true; m_fMinSeg = (minSeg == -1.0f) ? stroke / 5.0f : minSeg; m_fMinSeg *= m_fMinSeg; m_fStroke = stroke; m_fFadeDelta = 1.0f / fade; m_uMaxPoints = (int)(fade * 60.0f) + 2; m_uNuPoints = 0; m_pPointState = new float[m_uMaxPoints]; // (float *)malloc(sizeof(float) * m_uMaxPoints); m_pPointVertexes = new CCPoint[m_uMaxPoints]; // (CCPoint*)malloc(sizeof(CCPoint) * m_uMaxPoints); m_pVertices = new ccVertex2F[m_uMaxPoints * 2]; // (ccVertex2F*)malloc(sizeof(ccVertex2F) * m_uMaxPoints * 2); m_pTexCoords = new ccTex2F[m_uMaxPoints * 2];// (ccTex2F*)malloc(sizeof(ccTex2F) * m_uMaxPoints * 2); m_pColor = new ccColor4B[m_uMaxPoints * 2];// m_pColorPointer = (GLubyte*)malloc(sizeof(GLubyte) * m_uMaxPoints * 2 * 4); // Set blend mode m_tBlendFunc.src = OGLES.GL_SRC_ALPHA; m_tBlendFunc.dst = OGLES.GL_ONE_MINUS_SRC_ALPHA; // shader program // TODO: setup the shader program // setShaderProgram(CCShaderCache.sharedShaderCache().programForKey(kCCShader_PositionTextureColor)); Texture = texture; Color = color; // scheduleUpdate(); schedule(update); return true; }
public virtual bool onTextFieldInsertText(CCTextFieldTTF pSender, string text, int nLen) { // if insert enter, treat as default to detach with ime if ("\n" == text) { return false; } // if the textfield's char count more than m_nCharLimit, doesn't insert text anymore. if (pSender.CharCount >= m_nCharLimit) { return true; } // create a insert text sprite and do some action CCLabelTTF label = CCLabelTTF.labelWithString(text, TextInputTestScene.FONT_NAME, TextInputTestScene.FONT_SIZE); this.addChild(label); ccColor3B color = new ccColor3B { r = 226, g = 121, b = 7 }; label.Color = color; // move the sprite from top to position CCPoint endPos = pSender.position; if (pSender.CharCount > 0) { endPos.x += pSender.contentSize.width / 2; } CCSize inputTextSize = label.contentSize; CCPoint beginPos = new CCPoint(endPos.x, CCDirector.sharedDirector().getWinSize().height - inputTextSize.height * 2); float duration = 0.5f; label.position = beginPos; label.scale = 8; CCAction seq = CCSequence.actions( CCSpawn.actions( CCMoveTo.actionWithDuration(duration, endPos), CCScaleTo.actionWithDuration(duration, 1), CCFadeOut.actionWithDuration(duration)), CCCallFuncN.actionWithTarget(this, callbackRemoveNodeWhenDidAction)); label.runAction(seq); return false; }
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; }
//! helper macro that creates an ccColor3B type public static ccColor3B ccc3(byte r, byte g, byte b) { ccColor3B c = new ccColor3B(r, g, b); return c; }
/// <summary> /// Initializes the CCLayer with a gradient between start and end in the direction of v. /// </summary> public virtual bool initWithColor(ccColor4B start, ccColor4B end, CCPoint v) { m_endColor = new ccColor3B(); m_endColor.r = end.r; m_endColor.g = end.g; m_endColor.b = end.b; m_cEndOpacity = end.a; m_cStartOpacity = start.a; m_AlongVector = v; m_bCompressedInterpolation = true; return base.initWithColor(new ccColor4B(start.r, start.g, start.b, 255)); }
public override void onEnter() { base.onEnter(); Color = new ccColor3B(0,0,0); removeChild(m_background, true); m_background = null; m_emitter = new CCParticleSystemQuad(); m_emitter.initWithTotalParticles(100); addChild(m_emitter, 10); m_emitter.Texture = CCTextureCache.sharedTextureCache().addImage("Images/fire"); // duration m_emitter.Duration = (float)eParticleShowingProperty.kCCParticleDurationInfinity; // radius mode m_emitter.EmitterMode = (int)eParticleMode.kCCParticleModeRadius; // radius mode: start and end radius in pixels m_emitter.setStartRadius(50); m_emitter.setStartRadiusVar(0); m_emitter.setEndRadius((float)eParticleShowingProperty.kCCParticleStartRadiusEqualToEndRadius); m_emitter.setEndRadiusVar(0); // radius mode: degrees per second m_emitter.setRotatePerSecond(0); m_emitter.setRotatePerSecondVar(0); // angle m_emitter.Angle = 90; m_emitter.AngleVar = 0; // emitter position CCSize size = CCDirector.sharedDirector().getWinSize(); m_emitter.position = new CCPoint(size.width/2, size.height/2); m_emitter.PosVar = new CCPoint(0,0); // life of particles m_emitter.Life = 5; m_emitter.LifeVar = 0; // spin of particles m_emitter.StartSpin = 0; m_emitter.StartSpinVar = 0; m_emitter.EndSpin = 0; m_emitter.EndSpinVar = 0; // color of particles ccColor4F startColor = new ccColor4F(0.5f, 0.5f, 0.5f, 1.0f); m_emitter.StartColor = startColor; ccColor4F startColorVar = new ccColor4F(0.5f, 0.5f, 0.5f, 1.0f); m_emitter.StartColorVar = startColorVar; ccColor4F endColor = new ccColor4F(0.1f, 0.1f, 0.1f, 0.2f); m_emitter.EndColor = endColor; ccColor4F endColorVar = new ccColor4F(0.1f, 0.1f, 0.1f, 0.2f); m_emitter.EndColorVar = endColorVar; // size, in pixels m_emitter.StartSize = 16; m_emitter.StartSizeVar = 0; m_emitter.EndSize = (float)eParticleShowingProperty.kCCParticleStartSizeEqualToEndSize; // emits per second m_emitter.EmissionRate = m_emitter.TotalParticles / m_emitter.Life; // additive m_emitter.IsBlendAdditive = false; CCRotateBy rot = CCRotateBy.actionWithDuration(16, 360); m_emitter.runAction(CCRepeatForever.actionWithAction(rot)); }