Exemplo n.º 1
0
        public List <RendererPackage> GetRendererPackages()
        {
            List <RendererPackage> rendererPackages = new List <RendererPackage>();

            List <Sprite> tempChildren = this.GetChildren();

            foreach (Sprite sprite in tempChildren)
            {
                rendererPackages.Add(sprite.rendererPackage);
            }
            if (this.cloneOffset != Vector2.Zero)
            {
                List <Sprite> tempClones = this.GetClones();
                foreach (Sprite sprite in tempClones)
                {
                    rendererPackages.Add(sprite.rendererPackage);
                }
            }

            //Create a RendererPackage for the origin if debugging is true
            if (this.debugging)
            {
                RendererPackage debugPackage = new RendererPackage();
                debugPackage.texture       = this.debugTexture;
                debugPackage.destination   = new Rectangle((int)(this.parent.origin.X - 5), (int)(this.parent.origin.Y - 5), 10, 10);
                debugPackage.overloadIndex = 1;
                debugPackage.layer         = 100;
                debugPackage.color         = Color.Black;
                rendererPackages.Add(debugPackage);
            }
            return(rendererPackages);
        }
Exemplo n.º 2
0
        private void RenderPackage(RendererPackage rp)
        {
            //Render the RenderPackage by the right method overload
            switch (rp.overloadIndex)
            {
            case 1:
            {
                this.spriteBatch.Draw(rp.texture, rp.destination, rp.color);
                break;
            }

            case 2:
            {
                this.spriteBatch.Draw(rp.texture, rp.position, rp.color);
                break;
            }

            case 3:
            {
                this.spriteBatch.Draw(rp.texture, rp.destination, rp.source, rp.color);
                break;
            }

            case 4:
            {
                this.spriteBatch.Draw(rp.texture, rp.position, rp.source, rp.color);
                break;
            }

            case 5:
            {
                this.spriteBatch.Draw(rp.texture, rp.destination, rp.source, rp.color, rp.rotation, rp.origin, rp.spriteEffects, 0);
                break;
            }

            case 6:
            {
                this.spriteBatch.Draw(rp.texture, rp.position, rp.source, rp.color, rp.rotation, rp.origin, rp.scale.X, rp.spriteEffects, 0);
                break;
            }

            case 7:
            {
                this.spriteBatch.Draw(rp.texture, rp.position, rp.source, rp.color, rp.rotation, rp.origin, rp.scale, rp.spriteEffects, 0);
                break;
            }
            }
        }
Exemplo n.º 3
0
        private void RenderPackage(RendererPackage rp)
        {
            if (!rp.visible)
            {
                return;
            }

            Color ac = rp.color * rp.alpha;

            //Render the RenderPackage by the right method overload
            switch (rp.overloadIndex)
            {
            case 1:
            {
                this.spriteBatch.Draw(rp.texture, rp.destination, ac);
                break;
            }

            case 2:
            {
                this.spriteBatch.Draw(rp.texture, rp.position, ac);
                break;
            }

            case 3:
            {
                this.spriteBatch.Draw(rp.texture, rp.destination, rp.source, ac);
                break;
            }

            case 4:
            {
                this.spriteBatch.Draw(rp.texture, rp.position, rp.source, ac);
                break;
            }

            case 5:
            {
                this.spriteBatch.Draw(rp.texture, rp.destination, rp.source, ac, rp.rotation, rp.origin, rp.spriteEffects, 0);
                break;
            }

            case 6:
            {
                this.spriteBatch.Draw(rp.texture, rp.position, rp.source, ac, rp.rotation, rp.origin, rp.scale.X, rp.spriteEffects, 0);
                break;
            }

            case 7:
            {
                this.spriteBatch.Draw(rp.texture, rp.position, rp.source, ac, rp.rotation, rp.origin, rp.scale, rp.spriteEffects, 0);
                break;
            }

            case 8:
            {
                this.spriteBatch.DrawString(this.font, rp.text, rp.position, rp.color);
                break;
            }
            }
        }
Exemplo n.º 4
0
        public List<RendererPackage> GetRendererPackages()
        {
            List<RendererPackage> rendererPackages = new List<RendererPackage>();

            List<Sprite> tempChildren = this.GetChildren();

            foreach (Sprite sprite in tempChildren)
            {
                rendererPackages.Add(sprite.rendererPackage);
            }

            //Create a RendererPackage for the origin if debugging is true
            if (this.debugging)
            {
                RendererPackage debugPackage = new RendererPackage();
                debugPackage.texture = this.debugTexture;
                debugPackage.destination = new Rectangle((int)(this.parent.origin.X - 5), (int)(this.parent.origin.Y - 5), 10, 10);
                debugPackage.overloadIndex = 1;
                debugPackage.layer = 100;
                debugPackage.color = Color.Black;
                rendererPackages.Add(debugPackage);
            }
            return rendererPackages;
        }
Exemplo n.º 5
0
 private void RenderPackage(RendererPackage rp)
 {
     //Render the RenderPackage by the right method overload
     switch(rp.overloadIndex)
     {
         case 1:
         {
             this.spriteBatch.Draw(rp.texture, rp.destination, rp.color);
             break;
         }
         case 2:
         {
             this.spriteBatch.Draw(rp.texture, rp.position, rp.color);
             break;
         }
         case 3:
         {
             this.spriteBatch.Draw(rp.texture, rp.destination, rp.source, rp.color);
             break;
         }
         case 4:
         {
             this.spriteBatch.Draw(rp.texture, rp.position, rp.source, rp.color);
             break;
         }
         case 5:
         {
             this.spriteBatch.Draw(rp.texture, rp.destination, rp.source, rp.color, rp.rotation, rp.origin, rp.spriteEffects, 0);
             break;
         }
         case 6:
         {
             this.spriteBatch.Draw(rp.texture, rp.position, rp.source, rp.color, rp.rotation, rp.origin, rp.scale.X, rp.spriteEffects, 0);
             break;
         }
         case 7:
         {
             this.spriteBatch.Draw(rp.texture, rp.position, rp.source, rp.color, rp.rotation, rp.origin, rp.scale, rp.spriteEffects, -1);
             break;
         }
     }
 }