Example #1
0
        public void Render(RendererComponents rendererComponents)
        {
            List <RendererPackage> rendererPackages = rendererComponents.GetRendererPackages();

            foreach (RendererPackage rp in rendererPackages)
            {
                //Add the RenderPackage to the right layer
                switch (rp.layer)
                {
                case ObjectLayer:
                    this.objects.Add(rp);
                    break;

                case LightLayer:
                    this.lights.Add(rp);
                    break;

                case LightBlockerLayer:
                    this.lightBlockers.Add(rp);
                    break;

                case DebugLayer:
                    this.debug.Add(rp);
                    break;

                case MenuLayer:
                    this.menuItems.Add(rp);
                    break;

                case HudLayer:
                    this.hudItems.Add(rp);
                    break;
                }
            }
        }
Example #2
0
 public void Render(RendererComponents rendererComponents)
 {
     List<RendererPackage> rendererPackages = rendererComponents.GetRendererPackages();
     foreach (RendererPackage rp in rendererPackages)
     {
         //Add the RenderPackage to the right layer
         switch (rp.layer)
         {
             case ObjectLayer:
                 {
                     this.objects.Add(rp);
                     break;
                 }
             case LightLayer:
                 {
                     this.lights.Add(rp);
                     break;
                 }
             case LightBlockerLayer:
                 {
                     this.lightBlockers.Add(rp);
                     break;
                 }
             case DebugLayer:
                 {
                     this.debug.Add(rp);
                     break;
                 }
         }
     }
 }
Example #3
0
        public static Sprite CreateColoredRectangle(RendererComponents parent, Color color, float width, float height, Vector2 position, string name, int layer)
        {
            Sprite s = new Sprite(parent, OrujinGame.GetTexture2DByColor(color), position, new Vector2(1, 1), 0, color, layer, name, 1);

            s.SetOrigin(new Vector2(width / 2, height / 2));
            s.rendererPackage.destination = new Rectangle(0, 0, (int)width, (int)height);
            return(s);
        }
Example #4
0
        public static Sprite CreateSprite(RendererComponents parent, Texture2D texture, Vector2 position, Vector2 scale, float rotation, bool flipH, bool flipV, Nullable <Vector2> origin, string name, int layer)
        {
            Sprite s = new Sprite(parent, texture, position, scale, rotation, Color.White, layer, name, 7);

            s.SetOrigin(origin);
            s.rendererPackage.flipHorizontally = flipH;
            s.rendererPackage.flipVertically   = flipV;
            return(s);
        }
Example #5
0
        public static Sprite CreateSprite(RendererComponents parent, Texture2D texture, Vector2 position, Nullable <Vector2> origin, SpriteAnimation spriteAnimation, ModularAnimation ModularAnimation, Color color, string name)
        {
            Sprite s = new Sprite(parent, texture, position, new Vector2(1, 1), 0, color, 1, name, 2);

            s.SetOrigin(origin);
            s.AddAnimation(spriteAnimation);
            s.AddModularAnimation(ModularAnimation);
            return(s);
        }
Example #6
0
        public static Sprite CreateDebugText(RendererComponents parent, String text, Vector2 parentOffset, Color color)
        {
            Sprite s = new Sprite();

            s.name = "DebugText";
            s.rendererPackage.overloadIndex = 8;
            s.rendererPackage.layer         = RendererManager.DebugLayer;
            s.rendererPackage.color         = color;
            s.rendererPackage.parentOffset  = parentOffset;
            s.rendererPackage.text          = text;
            s.rendererPackage.debug         = true;
            s.rendererPackage.visible       = true;
            return(s);
        }
Example #7
0
        private Sprite(RendererComponents parent, Texture2D texture, Vector2 parentOffset, Vector2 scale, float rotation, Color color, int layer, string name, int overloadIndex)
        {
            this.parent = parent;
            this.rendererPackage.overloadIndex = overloadIndex;

            this.spriteAnimation                = null;
            this.rendererPackage.visible        = true;
            this.rendererPackage.texture        = texture;
            this.rendererPackage.destination    = new Rectangle(0, 0, texture.Bounds.Width, texture.Bounds.Height);
            this.rendererPackage.positionOffset = Vector2.Zero;
            this.rendererPackage.parentOffset   = parentOffset;
            this.rendererPackage.color          = color;
            this.rendererPackage.originalColor  = color;
            this.rendererPackage.layer          = layer;
            this.rendererPackage.rotation       = rotation;
            this.rendererPackage.scale          = scale;
            this.rendererPackage.defaultOrigin  = new Vector2(this.rendererPackage.destination.Center.X, this.rendererPackage.destination.Center.Y);
            this.rendererPackage.origin         = this.rendererPackage.defaultOrigin;
            this.rendererPackage.alpha          = 1;
            this.rendererPackage.useforBounds   = true;
            this.name = name;
            this.rendererPackage.debug = false;
        }