Example #1
0
 /// <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 {R = color.R, G = color.G, B = color.B, A = 0};
     }
     return true;
 }
Example #2
0
        //protected bool m_opacityChanged;
        public CCLayerColor()
        {
            m_cOpacity = 0;
            m_tColor = new CCColor3B(0, 0, 0);

            // default blend function
            m_tBlendFunc = new CCBlendFunc(CCMacros.CCDefaultSourceBlending, CCMacros.CCDefaultDestinationBlending);
        }
Example #3
0
        /**
        * Sets the color of the title to use for the specified state.
        *
        * @param color The color of the title to use for the specified state.
        * @param state The state that uses the specified color. The values are described
        * in "CCControlState".
        */
        public virtual void SetTitleColorForState(CCColor3B color, CCControlState state)
        {
            if (m_titleColorDispatchTable.ContainsKey(state))
            {
                m_titleColorDispatchTable.Remove(state);
            }

            m_titleColorDispatchTable.Add(state, color);

            // If the current state if equal to the given state we update the layout
            if (State == state)
            {
                NeedsLayout();
            }
        }
 void TintMe(CCColor3B theColor)
 {
     someSprite.Color = theColor;
 }
Example #5
0
        public override void NeedsLayout()
        {
            if (!m_bParentInited)
            {
                return;
            }
            // Hide the background and the label
            if (m_titleLabel != null)
            {
                m_titleLabel.Visible = false;
            }
            if (m_backgroundSprite != null)
            {
                m_backgroundSprite.Visible = false;
            }
            // Update anchor of all labels
            LabelAnchorPoint = m_labelAnchorPoint;

            // Update the label to match with the current state

            m_currentTitle = GetTitleForState(m_eState);
            m_currentTitleColor = GetTitleColorForState(m_eState);

            TitleLabel = GetTitleLabelForState(m_eState);

            var label = (ICCLabelProtocol) m_titleLabel;
            if (label != null && !String.IsNullOrEmpty(m_currentTitle))
            {
                label.Label = (m_currentTitle);
            }

            var rgbaLabel = (ICCRGBAProtocol) m_titleLabel;
            if (rgbaLabel != null)
            {
                rgbaLabel.Color = m_currentTitleColor;
            }
            if (m_titleLabel != null)
            {
                m_titleLabel.Position = new CCPoint(ContentSize.Width / 2, ContentSize.Height / 2);
            }

            // Update the background sprite
            BackgroundSprite = GetBackgroundSpriteForState(m_eState);
            if (m_backgroundSprite != null)
            {
                m_backgroundSprite.Position = new CCPoint(ContentSize.Width / 2, ContentSize.Height / 2);
            }

            // Get the title label size
            CCSize titleLabelSize = CCSize.Zero;
            if (m_titleLabel != null)
            {
                titleLabelSize = m_titleLabel.BoundingBox.Size;
            }

            // Adjust the background image if necessary
            if (m_doesAdjustBackgroundImage)
            {
                // Add the margins
                if (m_backgroundSprite != null)
                {
                    m_backgroundSprite.ContentSize = new CCSize(titleLabelSize.Width + m_marginH * 2, titleLabelSize.Height + m_marginV * 2);
                }
            }
            else
            {
                //TODO: should this also have margins if one of the preferred sizes is relaxed?
                if (m_backgroundSprite != null)
                {
                    CCSize preferredSize = m_backgroundSprite.PreferredSize;
                    if (preferredSize.Width <= 0)
                    {
                        preferredSize.Width = titleLabelSize.Width;
                    }
                    if (preferredSize.Height <= 0)
                    {
                        preferredSize.Height = titleLabelSize.Height;
                    }

                    m_backgroundSprite.ContentSize = preferredSize;
                }
            }

            // Set the content size
            CCRect rectTitle = CCRect.Zero;
            if (m_titleLabel != null)
            {
                rectTitle = m_titleLabel.BoundingBox;
            }
            CCRect rectBackground = CCRect.Zero;
            if (m_backgroundSprite != null)
            {
                rectBackground = m_backgroundSprite.BoundingBox;
            }

            CCRect maxRect = CCControlUtils.CCRectUnion(rectTitle, rectBackground);
            ContentSize = new CCSize(maxRect.Size.Width, maxRect.Size.Height);

            if (m_titleLabel != null)
            {
                m_titleLabel.Position = new CCPoint(ContentSize.Width / 2, ContentSize.Height / 2);
                // Make visible label
                m_titleLabel.Visible = true;
            }

            if (m_backgroundSprite != null)
            {
                m_backgroundSprite.Position = new CCPoint(ContentSize.Width / 2, ContentSize.Height / 2);
                // Make visible the background
                m_backgroundSprite.Visible = true;
            }
        }
Example #6
0
        //! helper macro that creates an ccColor3B type
        static public CCColor3B CreateColor(byte r, byte g, byte b)
        {
            CCColor3B c = new CCColor3B(r, g, b);

            return(c);
        }
Example #7
0
        /// <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));
        }
Example #8
0
        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 = "Particles/" + m_title;
            m_emitter.InitWithFile(filename);
            AddChild(m_emitter, 10);

            m_emitter.BlendAdditive = true;

            setEmitterPosition();
        }
Example #9
0
        public override void OnEnter()
        {
            base.OnEnter();

            Color = new CCColor3B(0, 0, 0);
            RemoveChild(m_background, true);
            m_background = null;

            var system = new CCParticleSystemQuad();
            system.InitWithFile("Particles/SpinningPeas");
            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);
        }
Example #10
0
        public void TintWithColor(CCColor3B colors)
        {
            Color = colors;

            for (int i = 0; i < m_uNuPoints * 2; i++)
            {
                m_pVertices[i].Colors = new CCColor4B(colors.R, colors.G, colors.B, 255);
            }
        }
Example #11
0
 //! helper macro that creates an ccColor3B type
 public static CCColor3B CreateColor(byte r, byte g, byte b)
 {
     CCColor3B c = new CCColor3B(r, g, b);
     return c;
 }
Example #12
0
        public bool InitWithFade(float fade, float minSeg, float stroke, CCColor3B color, string path)
        {
            Debug.Assert(!String.IsNullOrEmpty(path), "Invalid filename");

            CCTexture2D texture = CCTextureCache.SharedTextureCache.AddImage(path);
            return InitWithFade(fade, minSeg, stroke, color, texture);
        }
Example #13
0
        public bool InitWithFade(float fade, float minSeg, float stroke, CCColor3B color, CCTexture2D texture)
        {
            Position = CCPoint.Zero;
            AnchorPoint = CCPoint.Zero;
            IgnoreAnchorPointForPosition = true;
            m_bStartingPositionInitialized = false;

            m_tPositionR = CCPoint.Zero;
            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];
            m_pPointVertexes = new CCPoint[m_uMaxPoints];

            m_pVertices = new CCV3F_C4B_T2F[(m_uMaxPoints + 1) * 2];

            // Set blend mode
            m_tBlendFunc.Source = OGLES.GL_SRC_ALPHA;
            m_tBlendFunc.Destination = OGLES.GL_ONE_MINUS_SRC_ALPHA;

            // shader program
            // setShaderProgram(CCShaderCache.sharedShaderCache().programForKey(kCCShader_PositionTextureColor));

            Texture = texture;
            Color = color;
            ScheduleUpdate();

            return true;
        }
Example #14
0
 public static CCMotionStreak Create(float fade, float minSeg, float stroke, CCColor3B color, CCTexture2D texture)
 {
     var pRet = new CCMotionStreak();
     pRet.InitWithFade(fade, minSeg, stroke, color, texture);
     return pRet;
 }
Example #15
0
 public static CCMotionStreak Create(float fade, float minSeg, float stroke, CCColor3B color, string path)
 {
     var pRet = new CCMotionStreak();
     pRet.InitWithFade(fade, minSeg, stroke, color, path);
     return pRet;
 }
Example #16
0
        /** Returns a ccColor4F from a ccColor3B. Alpha will be 1.
         * @since v0.99.1
         */
        public static CCColor4F CreateColor(CCColor3B c)
        {
            CCColor4F c4 = new CCColor4F(c.R / 255.0f, c.G / 255.0f, c.B / 255.0f, 1.0f);

            return(c4);
        }
Example #17
0
        public bool InitWithTileFile(string tile, int tileWidth, int tileHeight, int itemsToRender)
        {
            Debug.Assert(tile != null, "title should not be null");

            m_uItemWidth = tileWidth;
            m_uItemHeight = tileHeight;

            m_cOpacity = 255;
            m_tColor = m_tColorUnmodified = CCTypes.CCWhite;
            m_bIsOpacityModifyRGB = true;

            m_tBlendFunc.Source = CCMacros.CCDefaultSourceBlending;
            m_tBlendFunc.Destination = CCMacros.CCDefaultDestinationBlending;

            var pNewAtlas = new CCTextureAtlas();
            pNewAtlas.InitWithFile(tile, itemsToRender);

            TextureAtlas = pNewAtlas;

            UpdateBlendFunc();
            UpdateOpacityModifyRgb();

            CalculateMaxItems();

            m_uQuadsToDraw = itemsToRender;

            return true;
        }
Example #18
0
 /** Returns a ccColor4F from a ccColor3B. Alpha will be 1.
  @since v0.99.1
  */
 public static CCColor4F CreateColor(CCColor3B c)
 {
     CCColor4F c4 = new CCColor4F(c.R / 255.0f, c.G / 255.0f, c.B / 255.0f, 1.0f);
     return c4;
 }
Example #19
0
        public bool InitWithString(string theString, string fntFile, float width, CCTextAlignment alignment, CCPoint imageOffset)
        {
            Debug.Assert(m_pConfiguration == null, "re-init is no longer supported");
            Debug.Assert((theString == null && fntFile == null) || (theString != null && fntFile != null), "Invalid params for CCLabelBMFont");

            CCTexture2D texture;

            if (!String.IsNullOrEmpty(fntFile))
            {
                CCBMFontConfiguration newConf = FNTConfigLoadFile(fntFile);
                Debug.Assert(newConf != null, "CCLabelBMFont: Impossible to create font. Please check file");

                m_pConfiguration = newConf;

                m_sFntFile = fntFile;

                try
                {
                texture = CCTextureCache.SharedTextureCache.AddImage(m_pConfiguration.AtlasName);
            }
                catch (Exception)
                {
                    // Try the 'images' ref location just in case.
                    try
                    {
                        texture = CCTextureCache.SharedTextureCache.AddImage(System.IO.Path.Combine("images", m_pConfiguration.AtlasName));
                    }
                    catch (Exception)
                    {
                        // Lastly, try <font_path>/images/<font_name>
                        string dir = System.IO.Path.GetDirectoryName(m_pConfiguration.AtlasName);
                        string fname = System.IO.Path.GetFileName(m_pConfiguration.AtlasName);
                        string newName = System.IO.Path.Combine(System.IO.Path.Combine(dir, "images"), fname);
                        texture = CCTextureCache.SharedTextureCache.AddImage(newName);
                    }
                }
            }
            else
            {
                texture = new CCTexture2D();
            }

            if (String.IsNullOrEmpty(theString))
            {
                theString = String.Empty;
            }

            if (base.InitWithTexture(texture, theString.Length))
            {
                m_pAlignment = alignment;
                m_tImageOffset = imageOffset;
                m_fWidth = width;
                m_cOpacity = 255;
                m_tColor = CCTypes.CCWhite;
                m_tContentSize = CCSize.Zero;
                m_bIsOpacityModifyRGB = m_pobTextureAtlas.Texture.HasPremultipliedAlpha;
                Label = (theString);
                AnchorPoint = new CCPoint(0.5f, 0.5f);
                return true;
            }
            return false;
        }
Example #20
0
 protected bool InitWithLabel(CCNode label, SEL_MenuHandler selector)
 {
     base.InitWithTarget(selector);
     m_fOriginalScale = 1.0f;
     m_tColorBackup = CCTypes.CCWhite;
     DisabledColor = new CCColor3B(126, 126, 126);
     Label = label;
     return true;
 }
Example #21
0
        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 = CCParticleSystem.kCCParticleDurationInfinity;

            // radius mode
            m_emitter.EmitterMode = CCEmitterMode.kCCParticleModeRadius;

            // radius mode: start and end radius in pixels
            m_emitter.StartRadius = (50);
            m_emitter.StartRadiusVar = (0);
            m_emitter.EndRadius = (CCParticleSystem.kCCParticleStartRadiusEqualToEndRadius);
            m_emitter.EndRadiusVar = (0);

            // radius mode: degrees per second
            m_emitter.RotatePerSecond = (0);
            m_emitter.RotatePerSecondVar = (0);

            // angle
            m_emitter.Angle = 90;
            m_emitter.AngleVar = 0;

            // emitter position
            CCSize size = CCDirector.SharedDirector.WinSize;
            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
            var startColor = new CCColor4F(0.5f, 0.5f, 0.5f, 1.0f);
            m_emitter.StartColor = startColor;

            var startColorVar = new CCColor4F(0.5f, 0.5f, 0.5f, 1.0f);
            m_emitter.StartColorVar = startColorVar;

            var endColor = new CCColor4F(0.1f, 0.1f, 0.1f, 0.2f);
            m_emitter.EndColor = endColor;

            var 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 = CCParticleSystem.kCCParticleStartSizeEqualToEndSize;

            // emits per second
            m_emitter.EmissionRate = m_emitter.TotalParticles / m_emitter.Life;

            // additive
            m_emitter.BlendAdditive = false;

            CCRotateBy rot = new CCRotateBy (16, 360);
            m_emitter.RunAction(new CCRepeatForever (rot));
        }
Example #22
0
 protected virtual void OnHandlePropTypeColor3(CCNode node, CCNode parent, string propertyName, CCColor3B color, CCBReader reader)
 {
     CCLog.Log("Unexpected property type: '{0}'!", propertyName);
     Debug.Assert(false);
 }
Example #23
0
        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 = new CCLabelTTF(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.WinSize.Height - inputTextSize.Height * 2);

            float duration = 0.5f;
            label.Position = beginPos;
            label.Scale = 8;

            CCAction seq = CCSequence.FromActions(
                CCSpawn.FromActions(
                    new CCMoveTo (duration, endPos),
                    new CCScaleTo(duration, 1),
                    new CCFadeOut  (duration)),
                new CCCallFuncN(callbackRemoveNodeWhenDidAction));
            label.RunAction(seq);
            return false;
        }
Example #24
0
 internal ccColor3BWapper(CCColor3B xcolor)
 {
     color = xcolor;
 }
Example #25
0
        private CCBKeyframe ReadKeyframe(kCCBPropType type)
        {
            var keyframe = new CCBKeyframe();

            keyframe.Time = ReadFloat();

            var easingType = (kCCBKeyframeEasing) ReadInt(false);
            float easingOpt = 0;
            object value = null;

            if (easingType == kCCBKeyframeEasing.kCCBKeyframeEasingCubicIn
                || easingType == kCCBKeyframeEasing.kCCBKeyframeEasingCubicOut
                || easingType == kCCBKeyframeEasing.kCCBKeyframeEasingCubicInOut
                || easingType == kCCBKeyframeEasing.kCCBKeyframeEasingElasticIn
                || easingType == kCCBKeyframeEasing.kCCBKeyframeEasingElasticOut
                || easingType == kCCBKeyframeEasing.kCCBKeyframeEasingElasticInOut)
            {
                easingOpt = ReadFloat();
            }
            keyframe.EasingType = easingType;
            keyframe.EasingOpt = easingOpt;

            if (type == kCCBPropType.kCCBPropTypeCheck)
            {
                value = new CCBValue(ReadBool());
            }
            else if (type == kCCBPropType.kCCBPropTypeByte)
            {
                value = new CCBValue(ReadByte());
            }
            else if (type == kCCBPropType.kCCBPropTypeColor3)
            {
                byte r = ReadByte();
                byte g = ReadByte();
                byte b = ReadByte();

                var c = new CCColor3B(r, g, b);
                value = ccColor3BWapper.Create(c);
            }
            else if (type == kCCBPropType.kCCBPropTypeDegrees)
            {
                value = new CCBValue(ReadFloat());
            }
            else if (type == kCCBPropType.kCCBPropTypeScaleLock || type == kCCBPropType.kCCBPropTypePosition)
            {
                float a = ReadFloat();
                float b = ReadFloat();

                value = new List<CCBValue>
                    {
                        new CCBValue(a),
                        new CCBValue(b)
                    };
            }
            else if (type == kCCBPropType.kCCBPropTypeSpriteFrame)
            {
                string spriteSheet = ReadCachedString();
                string spriteFile = ReadCachedString();

                CCSpriteFrame spriteFrame;

                if (String.IsNullOrEmpty(spriteSheet))
                {
                    CCTexture2D texture = CCTextureCache.SharedTextureCache.AddImage(CCFileUtils.RemoveExtension(spriteFile));
                    var bounds = new CCRect(0, 0, texture.ContentSize.Width, texture.ContentSize.Height);
                    spriteFrame = CCSpriteFrame.Create(texture, bounds);
                }
                else
                {
                    CCSpriteFrameCache frameCache = CCSpriteFrameCache.SharedSpriteFrameCache;

                    // Load the sprite sheet only if it is not loaded
                    if (!mLoadedSpriteSheets.Contains(spriteSheet))
                    {
                        frameCache.AddSpriteFramesWithFile(spriteSheet);
                        mLoadedSpriteSheets.Add(spriteSheet);
                    }

                    spriteFrame = frameCache.SpriteFrameByName(spriteFile);
                }
                value = spriteFrame;
            }

            keyframe.Value = value;

            return keyframe;
        }
Example #26
0
 public static ccColor3BWapper Create(CCColor3B color)
 {
     var ret = new ccColor3BWapper();
     ret.color.R = color.R;
     ret.color.G = color.G;
     ret.color.B = color.B;
     return ret;
 }
Example #27
0
        protected virtual CCColor3B ParsePropTypeColor3(CCNode node, CCNode parent, CCBReader reader, string propertyName)
        {
            byte red = reader.ReadByte();
            byte green = reader.ReadByte();
            byte blue = reader.ReadByte();

            var color = new CCColor3B(red, green, blue);
            if (reader.AnimatedProperties.Contains(propertyName))
            {
                ccColor3BWapper value = ccColor3BWapper.Create(color);
                reader.AnimationManager.SetBaseValue(value, node, propertyName);
            }
            return color;
        }
Example #28
0
        public virtual bool InitWithLabelAndBackgroundSprite(CCNode node, CCScale9Sprite backgroundSprite)
        {
            if (base.Init())
            {
                Debug.Assert(node != null, "Label must not be nil.");
                var label = node as ICCLabelProtocol;
                var rgbaLabel = node as ICCRGBAProtocol;
                Debug.Assert(backgroundSprite != null, "Background sprite must not be nil.");
                Debug.Assert(label != null || rgbaLabel != null || backgroundSprite != null);

                m_bParentInited = true;

                // Initialize the button state tables
                m_titleDispatchTable = new Dictionary<CCControlState, string>();
                m_titleColorDispatchTable = new Dictionary<CCControlState, CCColor3B>();
                m_titleLabelDispatchTable = new Dictionary<CCControlState, CCNode>();
                m_backgroundSpriteDispatchTable = new Dictionary<CCControlState, CCScale9Sprite>();

                TouchEnabled = true;
                m_isPushed = false;
                m_zoomOnTouchDown = true;

                m_currentTitle = null;

                // Adjust the background image by default
                SetAdjustBackgroundImage(true);
                PreferredSize = CCSize.Zero;
                // Zooming button by default
                m_zoomOnTouchDown = true;

                // Set the default anchor point
                IgnoreAnchorPointForPosition = false;
                AnchorPoint = new CCPoint(0.5f, 0.5f);

                // Set the nodes
                TitleLabel = node;
                BackgroundSprite = backgroundSprite;

                // Set the default color and opacity
                Color = new CCColor3B(255, 255, 255);
                Opacity = 255;
                IsOpacityModifyRGB = true;

                // Initialize the dispatch table

                string tempString = label.Label;
                //tempString->autorelease();
                SetTitleForState(tempString, CCControlState.Normal);
                SetTitleColorForState(rgbaLabel.Color, CCControlState.Normal);
                SetTitleLabelForState(node, CCControlState.Normal);
                SetBackgroundSpriteForState(backgroundSprite, CCControlState.Normal);

                LabelAnchorPoint = new CCPoint(0.5f, 0.5f);

                NeedsLayout();

                return true;
            }
            //couldn't init the CCControl
            return false;
        }
Example #29
0
 /// <summary>
 /// creates the transition with a duration and with an RGB color
 /// Example: FadeTransition::create(2, scene, ccc3(255,0,0); // red color
 /// </summary>
 public CCTransitionFade(float duration, CCScene scene, CCColor3B color)
     : base(duration, scene)
 {
     InitWithDuration(duration, scene, color);
 }
Example #30
0
        public bool InitWithTexture(CCTexture2D pTexture, CCRect rect, bool rotated)
        {
            m_pobBatchNode = null;

            // shader program
            //setShaderProgram(CCShaderCache::sharedShaderCache()->programForKey(kCCShader_PositionTextureColor));

            m_bRecursiveDirty = false;
            Dirty = false;

            m_bOpacityModifyRGB = true;
            m_nOpacity = 255;
            m_sColor = m_sColorUnmodified = CCTypes.CCWhite;

            m_sBlendFunc.Source = CCMacros.CCDefaultSourceBlending;
            m_sBlendFunc.Destination = CCMacros.CCDefaultDestinationBlending;

            m_bFlipX = m_bFlipY = false;

            // default transform anchor: center
            AnchorPoint = new CCPoint(0.5f, 0.5f);

            // zwoptex default values
            m_obOffsetPosition = CCPoint.Zero;

            m_bHasChildren = false;

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

            // Atlas: Color
            var tmpColor = new CCColor4B(255, 255, 255, 255);
            m_sQuad.BottomLeft.Colors = tmpColor;
            m_sQuad.BottomRight.Colors = tmpColor;
            m_sQuad.TopLeft.Colors = tmpColor;
            m_sQuad.TopRight.Colors = tmpColor;

            // update texture (calls updateBlendFunc)
            Texture = pTexture;
            SetTextureRect(rect, rotated, rect.Size);

            // by default use "Self Render".
            // if the sprite is added to a batchnode, then it will automatically switch to "batchnode Render"
            BatchNode = null;

            return true;
        }