Пример #1
0
        public BoxSprite()
        {
            this.name = BoxSprite.Name.Uninitialized;

            Debug.Assert(BoxSprite.poScreenRect != null);
            BoxSprite.poScreenRect.Set(0, 0, 1, 1);
            Debug.Assert(BoxSprite.poColor != null);
            BoxSprite.poColor.Set(1, 1, 1);

            // Here is the actual new
            this.poBoxSprite = new Azul.SpriteBox(poScreenRect, poColor);
            Debug.Assert(this.poBoxSprite != null);

            // Here is the actual new
            this.poLineColor = new Azul.Color(1, 1, 1);
            Debug.Assert(this.poLineColor != null);

            this.x     = poBoxSprite.x;
            this.y     = poBoxSprite.y;
            this.sx    = poBoxSprite.sx;
            this.sy    = poBoxSprite.sy;
            this.angle = poBoxSprite.angle;

            this.speedX = 0;
            this.speedY = 0;
        }
Пример #2
0
        // Constructors/Destructors: -------------------------------------------
        public GameSprite()
        {
            //SPRITE COLOR!
            //set the default color to white
            this.poColor = new Azul.Color(defaultSpriteColor_White);
            Debug.Assert(this.poColor != null);

            //default field values
            this.name = Name.Blank;

            //create a NullObject image by default to avoid breaking find;
            this.pImage = ImageManager.Find(Image.Name.NullObject);
            Debug.Assert(this.pImage != null);

            Debug.Assert(pPrivScreenRect != null);
            Debug.Assert(defaultSpriteColor_White != null);

            this.poScreenRect = new Azul.Rect(pPrivScreenRect);
            Debug.Assert(poScreenRect != null);

            this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), pPrivScreenRect, this.poColor);
            Debug.Assert(this.poAzulSprite != null);

            this.x     = poAzulSprite.x;
            this.y     = poAzulSprite.y;
            this.sx    = poAzulSprite.sx;
            this.sy    = poAzulSprite.sy;
            this.angle = poAzulSprite.angle;
        }
Пример #3
0
        public Sprite()
        {
            this.name = Sprite.Name.Uninitialized;

            this.pImage = ImageManager.Find(Image.Name.Uninitialized);
            Debug.Assert(this.pImage != null);

            this.poScreenRect = new Azul.Rect();
            Debug.Assert(this.poScreenRect != null);
            this.poScreenRect.Clear();

            this.poColor = new Azul.Color(1, 1, 1);
            Debug.Assert(this.poColor != null);

            this.poSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), poScreenRect, poColor);
            Debug.Assert(this.poSprite != null);

            this.x     = poSprite.x;
            this.y     = poSprite.y;
            this.sx    = poSprite.sx;
            this.sy    = poSprite.sy;
            this.angle = poSprite.angle;

            this.speedX = 0;
            this.speedY = 0;
        }
Пример #4
0
        //static Azul.Rect poRect = new Azul.Rect();


        public GameSprite()
            : base()
        {
            this.name = GameSprite.Name.Unitialized;

            //use the default for now and replace later in the Set
            this.pImage = ImageMan.Find(Image.Name.Default);
            Debug.Assert(this.pImage != null);

            this.poScreenRect = new Azul.Rect();
            Debug.Assert(this.pImage != null);

            //make sure nothing is there already?
            this.poScreenRect.Clear();

            Debug.Assert(GameSprite.psTempColor != null);
            GameSprite.psTempColor.Set(1, 1, 1);

            this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), this.poScreenRect, psTempColor);
            Debug.Assert(this.poAzulSprite != null);

            this.poAzulColor = new Azul.Color(1, 1, 1);
            Debug.Assert(this.poAzulColor != null);

            this.x     = poAzulSprite.x;
            this.y     = poAzulSprite.y;
            this.sx    = poAzulSprite.sx;
            this.sy    = poAzulSprite.sy;
            this.angle = poAzulSprite.angle;
        }
Пример #5
0
        //---------------------------------------------------------------------------------------------------------
        // Constructor
        //---------------------------------------------------------------------------------------------------------
        public GameSprite()
            : base()
        {
            this.name = GameSprite.Name.Uninitialized;

            // Use the default - it will be replaced in the Set
            this.pImage = ImageManager.Find(Image.Name.Default);
            Debug.Assert(this.pImage != null);

            this.poScreenRect = new Azul.Rect();
            Debug.Assert(this.poScreenRect != null);
            this.poScreenRect.Clear();

            // here is the actual new
            this.poAzulColor = new Azul.Color(1, 1, 1);
            Debug.Assert(this.poAzulColor != null);

            // here is the actual new
            this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), this.poScreenRect, psTmpColor);
            Debug.Assert(this.poAzulSprite != null);

            this.x     = poAzulSprite.x;
            this.y     = poAzulSprite.y;
            this.sx    = poAzulSprite.sx;
            this.sy    = poAzulSprite.sy;
            this.angle = poAzulSprite.angle;
        }
Пример #6
0
        public BoxSprite()
        {
            //set the name;
            this.name = GameSprite.Name.Blank;

            Debug.Assert(pPrivScreenRect != null);
            Debug.Assert(defaultBoxColor_Red != null);

            //initialize default line color of all sprite box objects
            this.poLineColor = new Azul.Color(defaultBoxColor_Red);

            Debug.Assert(this.poLineColor != null);

            //initialize screen coordinates
            this.poScreenRect = new Azul.Rect(pPrivScreenRect);
            Debug.Assert(this.poScreenRect != null);

            //initialize azul sprite box
            this.poAzulSpriteBox = new Azul.SpriteBox(pPrivScreenRect, this.poLineColor);
            Debug.Assert(this.poAzulSpriteBox != null);

            //pull the coordinates
            this.x     = poAzulSpriteBox.x;
            this.y     = poAzulSpriteBox.y;
            this.sx    = poAzulSpriteBox.sx;
            this.sy    = poAzulSpriteBox.sy;
            this.angle = poAzulSpriteBox.angle;
        }
Пример #7
0
        public void Set(BoxSprite.Name name, Azul.Color pLineColor = null)
        {
            Debug.Assert(this.poBoxSprite != null);
            Debug.Assert(this.poLineColor != null);

            Debug.Assert(poScreenRect != null);

            this.name = name;

            if (pLineColor == null)
            {
                this.poLineColor.Set(1, 1, 1);
            }
            else
            {
                this.poLineColor.Set(pLineColor);
            }

            this.poBoxSprite.SwapColor(this.poLineColor);
            Debug.Assert(this.poBoxSprite != null);

            this.x     = poBoxSprite.x;
            this.y     = poBoxSprite.y;
            this.sx    = poBoxSprite.sx;
            this.sy    = poBoxSprite.sy;
            this.angle = poBoxSprite.angle;
        }
Пример #8
0
        //
        // Constructor
        //

        public Collider()
        {
            this.collisionSprite  = null;
            this.colliderBoundary = new Azul.Rect();
            this.gameObjectId     = 0u;
            this.color            = Colors.Green;
        }
Пример #9
0
        public void Set(GameSprite.Name boxName, Azul.Rect pScreenRect, Azul.Color pColor)
        {
            //null checks
            Debug.Assert(pScreenRect != null);
            Debug.Assert(defaultBoxColor_Red != null);
            Debug.Assert(this.poAzulSpriteBox != null);
            Debug.Assert(this.poScreenRect != null);

            //set the name
            this.name = boxName;

            Debug.Assert(pPrivScreenRect != null);

            //set either a default color or a color input;
            if (pColor == null)
            {
                //set to static red (default)
                this.poLineColor.Set(defaultBoxColor_Red);
            }
            else
            {
                this.poLineColor.Set(pColor);
            }

            this.poAzulSpriteBox.Swap(pScreenRect, this.poLineColor);
            Debug.Assert(this.poAzulSpriteBox != null);

            this.x     = poAzulSpriteBox.x;
            this.y     = poAzulSpriteBox.y;
            this.sx    = poAzulSpriteBox.sx;
            this.sy    = poAzulSpriteBox.sy;
            this.angle = poAzulSpriteBox.angle;
        }
Пример #10
0
        public Ship(Azul.Rect screenRect, Azul.Color color)
            : base(GAMEOBJECT_TYPE.SHIP, new Azul.Rect(0, 0, 32, 32), screenRect, GameObject.shipTexture, color)
        {
            PhysicBody_Data data = new PhysicBody_Data();

            data.position   = new Vec2(screenRect.x, screenRect.y);
            data.size       = new Vec2(screenRect.width, screenRect.height);
            data.active     = true;
            data.angle      = 0;
            data.shape_type = PHYSICBODY_SHAPE_TYPE.SHIP_MANIFOLD;
            //data.isSensor = true;
            CreatePhysicBody(data);

            // maxSpeed is m/s
            maxSpeed = 150.0f;

            maxForce    = 20f;
            rotateSpeed = 5.0f;
            heading     = new Vec2((float)System.Math.Cos(pBody.GetAngleDegs()), (float)System.Math.Sin(pBody.GetAngleDegs()));

            mineCount    = 5;
            missileCount = 3;
            shipColor    = color;

            respawnPos = new Vec2(screenRect.x, screenRect.y);
        }
Пример #11
0
        public Ship(Azul.Rect screenRect, Azul.Color color)
            : base(GAMEOBJECT_TYPE.SHIP, new Azul.Rect(0, 0, 32, 32), screenRect, GameObject.shipTexture, color)
        {
            //PhysicBody_Data data = new PhysicBody_Data();

            //data.position = new Vec2(screenRect.x, screenRect.y);
            //data.size = new Vec2(screenRect.width, screenRect.height);

            //data.angle = 0;
            //data.shape_type = PHYSICBODY_SHAPE_TYPE.SHIP_MANIFOLD;
            //CreatePhysicBody(data);

            //maxSpeed is pixels / sec
            maxSpeed = 150.0f;

            maxForce    = 20f;
            rotateSpeed = 5.0f;
            // heading = new Vec2((float)System.Math.Cos(pBody.GetAngleDegs()), (float)System.Math.Sin(pBody.GetAngleDegs()));
            prevPos = new Vec2(screenRect.x, screenRect.y);
            curPos  = prevPos;


            //prevTime = GetTime();
            //curTime = prevTime;

            curVelocity = new Vec2(0.0f, 0.0f);


            missileCount = 3;
            shipColor    = color;

            respawnPos = new Vec2(screenRect.x, screenRect.y);
        }
Пример #12
0
        //private static void SetUpTrick()
        //{
        //    Debug.Assert(BoxSprite.psTmpRect != null);
        //    BoxSprite.psTmpRect.Set(0, 0, 1, 1);
        //    Debug.Assert(BoxSprite.psTmpColor != null);
        //    BoxSprite.psTmpColor.Set(1, 1, 1);
        //}

        //---------------------------------------------------------------------------------------------------------
        // Methods
        //---------------------------------------------------------------------------------------------------------
        public void Set(float x, float y, float width, float height, Azul.Color pLineColor)
        {
            Debug.Assert(this.pBox != null);
            Debug.Assert(this.pColor != null);

            Debug.Assert(psTmpRect != null);
            BoxSprite.psTmpRect.Set(x, y, width, height);

            if (pLineColor == null)
            {
                this.pColor.Set(1, 1, 1);
            }
            else
            {
                this.pColor.Set(pLineColor);
            }

            this.pBox.Swap(psTmpRect, this.pColor);

            this.x     = pBox.x;
            this.y     = pBox.y;
            this.sx    = pBox.sx;
            this.sy    = pBox.sy;
            this.angle = pBox.angle;
        }
Пример #13
0
        public GameSprite() : base()
        {
            // resets to default parameters
            this.Wash();

            // Use Default Values
            this.pImage = ImageManager.Find(Image.Name.Default);
            Debug.Assert(pImage != null);

            // Prep Rect
            this.poScreenRect = new Azul.Rect();
            Debug.Assert(this.poScreenRect != null);
            this.poScreenRect.Clear();

            // Prep Color
            this.poAzulColor = new Azul.Color(1, 1, 1);
            Debug.Assert(this.poAzulColor != null);

            // Prep Sprite
            this.poAzulSprite = new Azul.Sprite(pImage.GetAzulTexture(), pImage.GetAzulRect(), this.poScreenRect, this.poAzulColor);
            Debug.Assert(this.poAzulSprite != null);

            //grab data from the Azul Sprite
            this.x     = poAzulSprite.x;
            this.y     = poAzulSprite.y;
            this.sx    = poAzulSprite.sx;
            this.sy    = poAzulSprite.sy;
            this.angle = poAzulSprite.angle;
        }
Пример #14
0
        public Mine(Azul.Rect destRect, int owner, Azul.Color color)
            : base(GAMEOBJECT_TYPE.MINE, new Azul.Rect(0, 0, 12, 12), destRect, GameObject.mineTexture, color)
        {
            PhysicBody_Data data = new PhysicBody_Data();

            data.position = new Vec2(destRect.x, destRect.y);
            data.size     = new Vec2(destRect.width, destRect.height);
            //data.radius = 25f;
            data.isSensor   = true;
            data.angle      = 0;
            data.shape_type = PHYSICBODY_SHAPE_TYPE.DYNAMIC_BOX;

            ownerID = owner;

            lifeTime = 5.0f;

            armDelay = 2.0f;

            mine1 = pSprite;
            mine2 = new Azul.Sprite(GameObject.mineTexture2, new Azul.Rect(0, 0, 12, 12), destRect, new Azul.Color(1, 0, 0));

            drawMine2 = false;

            CreatePhysicBody(data);
            lifeTimer = new Stopwatch();

            animTimer = new Stopwatch();
            animTimer.Start();
            armedTimer = new Stopwatch();
            armedTimer.Start();


            state = MINE_STATE.LAYED;
        }
Пример #15
0
 /// <summary>
 ///		Clears base sprite data
 /// </summary>
 virtual protected void SpriteReset()
 {
     this.name  = Sprite.Name.UNINITIALIZED;
     this.color = Colors.White;
     this.x     = 0.0f;
     this.y     = 0.0f;
 }
Пример #16
0
        //
        // Constructors
        //

        public Sprite() : base()
        {
            this.name  = Sprite.Name.UNINITIALIZED;
            this.color = Colors.White;
            this.x     = 0.0f;
            this.y     = 0.0f;
        }
Пример #17
0
 public void SwapColor(Azul.Color _pColor)
 {
     Debug.Assert(_pColor != null);
     Debug.Assert(this.poAzulColor != null);
     Debug.Assert(this.poAzulSprite != null);
     this.poAzulColor.Set(_pColor);
     this.poAzulSprite.SwapColor(_pColor);
 }
Пример #18
0
 public Sprite()
     : base()
 {
     this.pAzulSprite = new Azul.Sprite();
     this.pScreenRect = new Azul.Rect();
     this.pColor      = new Azul.Color(1.0f, 1.0f, 1.0f);
     this.pImage      = new Image();
 }
Пример #19
0
 //todo clean up boxsprite line color management
 public void ChangeColor(Azul.Color _pColor)
 {
     Debug.Assert(_pColor != null);
     Debug.Assert(this.poLineColor != null);
     Debug.Assert(this.poAzulSpriteBox != null);
     this.poLineColor.Set(_pColor);
     this.poAzulSpriteBox.SwapColor(this.poLineColor);
 }
Пример #20
0
        public override DLink Wash()
        {
            this.poAzulSpriteBox = null;
            this.name            = Name.Uninitialized;
            this.color           = null;

            return(this);
        }
Пример #21
0
 public GameObject(GAMEOBJECT_TYPE _type, Azul.Rect textureRect, Azul.Rect screenRect, Azul.Texture text, Azul.Color c)
 {
     type        = _type;
     color       = c;
     pSprite     = new Azul.Sprite(text, textureRect, screenRect, color);
     pScreenRect = screenRect;
     id          = IDNUM++;
     alive       = true;
 }
Пример #22
0
 protected BaseSprite()
 {
     this.index = Index.Index_Null;
     this.name = SpriteEnum.Not_Initialized;
     this.batch = null;
     this.xPos = 0f;
     this.yPos = 0f;
     this.sprColor = null;
 }
Пример #23
0
        private float halfHeight;               // Recaulcated only when height changes


        //
        // Constructors
        //

        /// <summary>
        ///		Private common constructor
        /// </summary>
        private void ctor(float x, float y, float w, float h, Azul.Color color, float thickness)
        {
            this.x          = x;
            this.y          = y;
            this.width      = w;
            this.height     = h;
            this.halfWidth  = w / 2.0f;
            this.halfHeight = h / 2.0f;
            this.lineColor  = color;
            this.outline    = new Azul.Line(thickness, color, x, y, w, h);
        }
        public ProxyCollisionSprite(Azul.Color color, SpriteEnum name, Index index)
            : base()
        {
            Debug.Assert(color != null);
            //Debug.Assert(name.Equals(SpriteEnum.Collision));
            //Debug.Assert(index.Equals(Index.Index_Null));

            setBase(name, index, 0.0f, 0.0f);
            colSprite = CollisionSpriteManager.find(SpriteEnum.Collision, Index.Index_Null);
            grid = new Azul.Rect();
            gridColor = color;
        }
Пример #25
0
 public GameObject(GameObject.Name goName, SpriteEnum name, Index index, Azul.Color color, Azul.Color colColor, float x, float y)
 {
     this.colObj = new CollisionObject(name, index, colColor);
     this.goColor = color;
     this.name = goName;
     this.index = index;
     this.x = x;
     this.y = y;
     angle = 0.0f;
     sx = 1;
     sy = 1;
 }
Пример #26
0
        public FontSprite()
            : base()
        {
            // Create a dummy sprite, it will get correctly linked in Set()

            this.pAzulSprite = new Azul.Sprite();
            this.pScreenRect = new Azul.Rect();
            this.pColor      = new Azul.Color(1.0f, 1.0f, 1.0f);

            this.pMessage  = null;
            this.glyphName = Glyph.Name.Uninitialized;
        }
Пример #27
0
        //----------------------------------------------------------------------------------
        // Constructor
        //----------------------------------------------------------------------------------
        public FontSprite() : base()
        {
            // Make a dummy sprite.  Will be finished by Set() Method later.
            this.x         = 0.0f;
            this.y         = 0.0f;
            this.glyphName = Glyph.Name.Uninitialized;
            this.pMessage  = null;

            this.pAzulSprite = new Azul.Sprite();
            this.pScreenRect = new Azul.Rect();
            this.pColor      = new Azul.Color(1.0f, 1.0f, 1.0f);
        }
Пример #28
0
        public FontSprite() : base()
        {
            this.azulSprite = new Azul.Sprite();
            this.screenRect = new Azul.Rect();
            this.fontColor  = new Azul.Color(1, 0, 0);

            this.text      = null;
            this.glyphName = Glyph.Name.Uninitialized;

            this.x = 0.0f;
            this.y = 0.0f;
        }
Пример #29
0
        public FontSprite()
        {
            this.pAzulSprite = new Azul.Sprite();
            this.pScreenRect = new Azul.Rect();
            this.pColor      = new Azul.Color(1.0f, 1.0f, 1.0f);

            this.pMessage  = null;
            this.glyphName = Glyph.Name.Uninitialized;

            this.x = 0.0f;
            this.y = 0.0f;
        }
Пример #30
0
 public SpriteBox()
     : base()
 {
     this.name           = SpriteBaseName.Uninitialized;
     this.pAzulSpriteBox = new Azul.SpriteBox();
     this.pLineColor     = ColorFactory.Create(ColorName.White).pAzulColor;
     this.pScreenRect    = new Azul.Rect();
     this.x     = 0.0f;
     this.y     = 0.0f;
     this.sx    = 1.0f;
     this.sy    = 1.0f;
     this.angle = 0.0f;
 }
Пример #31
0
 public RectDrawable(float x, float y, float w, float h, Azul.Color color, float thickness)
 {
     //this.outline = null;
     //this.ctor(x, y, w, h, color, thickness);
     this.x          = x;
     this.y          = y;
     this.width      = w;
     this.height     = h;
     this.halfWidth  = w / 2.0f;
     this.halfHeight = h / 2.0f;
     this.lineColor  = color;
     this.outline    = new Azul.Line(thickness, color, x, y, w, h);
 }
Пример #32
0
        public HudIcon(float newX, float newY, Azul.Color newColor, float iconSpacing, int numOfIcons, Sprite.Name newIconName)
        {
            this.spriteIcon    = SpriteEntityManager.Self.Find(newIconName);
            this.color         = newColor;
            this.x             = newX;
            this.y             = newY;
            this.iconGap       = iconSpacing;
            this.numberOfIcons = numOfIcons;

            if (this.numberOfIcons < 0)
            {
                this.numberOfIcons = 0;
            }
        }
Пример #33
0
        public static BoxSprite Add(BoxSprite.Name name, Azul.Color pColor = null)
        {
            BoxSpriteManager pMan = BoxSpriteManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            BoxSprite pNode = (BoxSprite)pMan.BaseAdd();

            Debug.Assert(pNode != null);

            pNode.Set(name, pColor);

            return(pNode);
        }
Пример #34
0
 public void setColor(Azul.Color color)
 {
     goColor = color;
 }