Example #1
0
        /* Useful for wrapping
         *  verts in a Shape 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 is cShape))
            {
                return;                        //You're done if psprite isn't a cShape*.
            }
            cShape pShape = (cShape)(psprite); /* I know it is a cShape
                                                * at this point, but I need to do a cast, so the compiler will let me
                                                * call a bunch of cShape methods. */

            //Arrays
            _vectorvert.Copy(pShape._vectorvert);
            //Decoration fields
            cColorStyle c = new cColorStyle();

            c.copy(pShape.pcolorstyle());
            ColorStyle = c;
            cColorStyle c2 = new cColorStyle();

            c2.copy(pShape.DotColorStyle);
            DotColorStyle        = c2;
            _dotted              = pShape._dotted;
            _realdotradiusweight = pShape._realdotradiusweight;
            //Helper fields
            _convex = pShape._convex;
        }
Example #2
0
 public virtual void copy(cSprite psprite)
 {
     _radius = psprite._radius;
     _prismdz = psprite._prismdz;
     _spriteattitude.copy(psprite._spriteattitude);
     _resourceID = psprite._resourceID;
     cColorStyle c = new cColorStyle();
     c.copy(psprite.pcolorstyle());
     ColorStyle = c;
 }
Example #3
0
        //Makes a default regular Shape with n verts.

        public cShape(int n, cVector3[] pverts, cColorStyle pcolorstyle = null)
        {
            _initializer();
            for (int i = 0; i < n; i++)
            {
                _vectorvert.Add(pverts[i]);
            }
            if (pcolorstyle != null)
            {
                cColorStyle c = new cColorStyle();
                c.copy(pcolorstyle);
                ColorStyle = c; //Otherwise keep the default.
            }
            fixCenterAndRadius();
        }
        public void setPlainRectangle(int boxside)
        {
            if (!(_childspriteptr.Size > boxside))
            {
                return;
            }
            cSpriteRectangle prect = null;

            switch (boxside)
            {
            case 0:
                prect = new cSpriteRectangle(Loy, Loz, Hiy, Hiz);
                _childspriteptr.SetAt(boxside, prect);;
                break;

            case 1:
                prect = new cSpriteRectangle(Loy, Loz, Hiy, Hiz);
                _childspriteptr.SetAt(boxside, prect);;
                break;

            case 2:
                prect = new cSpriteRectangle(Lox, Loz, Hix, Hiz);
                _childspriteptr.SetAt(boxside, prect);;
                break;

            case 3:
                prect = new cSpriteRectangle(Lox, Loz, Hix, Hiz);
                _childspriteptr.SetAt(boxside, prect);;
                break;

            case 4:
                prect = new cSpriteRectangle(Lox, Loy, Hix, Hiy);
                _childspriteptr.SetAt(boxside, prect);;
                break;

            case 5:
                prect = new cSpriteRectangle(Lox, Loy, Hix, Hiy);
                _childspriteptr.SetAt(boxside, prect);;
                break;
            }
            cColorStyle c = new cColorStyle();

            c.copy(pcolorstyle());
            prect.ColorStyle = c;             //Use the base class colorstyle.
            _fixspriteattitude(boxside);
            fixResourceID();
        }