/* Useful for wrapping * verts in a polygon class to pass to pgraphics->draw. */ //Overloaded cSprite methods public override void copy(cSprite psprite) //Use this in copy constructor and operator= { /* Because our class has some CArray fields, we can't use the default overloaded * copy constructor and operator=. So as to avoid having to maintain similar code * for these two different methods, we write a helper copy function that both * the copy constructor and the operator= can use. */ base.copy(psprite); //does center(), _radius, _angle, _rotationspeed. if (!psprite.IsKindOf("cPolygon")) { return; //You're done if psprite isn't a cPolygon*. } cPolygon ppolygon = (cPolygon)(psprite); /* I know it is a cPolygon * at this point, but I need to do a cast, so the compiler will let me * call a bunch of cPolygon methods. */ //Arrays _vectorvert.Copy(ppolygon._vectorvert); //Decoration fields cColorStyle c = new cColorStyle(); c.copy(ppolygon.pcolorstyle()); ColorStyle = c; cColorStyle c2 = new cColorStyle(); c2.copy(ppolygon.DotColorStyle); DotColorStyle = c2; _dotted = ppolygon._dotted; _realdotradiusweight = ppolygon._realdotradiusweight; //Helper fields _convex = ppolygon._convex; }
//Just sets the fill colors //cSprite overloads public override void copy( cSprite psprite ) //Use this in copy constructor and operator= { base.copy( psprite ); if ( !psprite.IsKindOf( "cSpriteTextureBox" )) return ; //You're done if psprite isn't a cSpriteTextureBox*. cSpriteTextureBox ptexturebox = ( cSpriteTextureBox )( psprite ); /* I know it is a cSpriteTextureBox at this point, but I need to do a cast, so the compiler will let me call cSpriteTextureBox methods. */ _pskeleton.copy(ptexturebox._pskeleton); }
//cSprite overloads public override void copy( cSprite psprite ) //Use this in copy constructor and operator= { base.copy( psprite ); if ( !psprite.IsKindOf( "cSpriteIcon" )) return ; //You're done if psprite isn't a cSpriteIcon*. cSpriteIcon picon = ( cSpriteIcon )( psprite ); /* I know it is a cSpriteIcon at this point, but I need to do a cast, so the compiler will let me call cSpriteIcon methods. */ _transparent = picon._transparent; Aspect = picon._aspect; //Sets _aspect, _sizex, _sizey, _visualradius _presetaspect = picon._presetaspect; _bitmapcolor = picon._bitmapcolor; _xtilecount = picon._xtilecount; _tiled = picon._tiled; }
public override void copy(cSprite psprite) { base.copy(psprite); _childspriteptr.RemoveAll(); if (!psprite.IsKindOf("cSpriteComposite")) return; //You're done if psprite isn't a cSpriteComposite. cSpriteComposite pspritecomposite = (cSpriteComposite)psprite; /* I know it is a cSpriteComposite at this point, but I need to do a cast, so the compiler will let me access it's cSpriteComposite member _childspriteptr. */ foreach (cSprite s in pspritecomposite._childspriteptr) add(s); NewGeometryFlag = true; }