Example #1
0
        public override void Render(Vector2 topLeft, Vector2 bottomRight)
        {
            if (!visible)
            {
                return;
            }

            var position = Owner.GetComponent <ITransformComponent>().Position;

            if (position.X < topLeft.X ||
                position.X > bottomRight.X ||
                position.Y < topLeft.Y ||
                position.Y > bottomRight.Y)
            {
                return;
            }

            base.Render(topLeft, bottomRight);

            if (_speechBubble != null)
            {
                _speechBubble.Draw(CluwneLib.WorldToScreen(position),
                                   new Vector2(), currentBaseSprite);
            }
        }
Example #2
0
        public override void Render(Vector2 topLeft, Vector2 bottomRight)
        {
            if (!visible)
            {
                return;
            }

            var position = Owner.GetComponent <ITransformComponent>().WorldPosition;

            if (position.X < topLeft.X ||
                position.X > bottomRight.X ||
                position.Y < topLeft.Y ||
                position.Y > bottomRight.Y)
            {
                return;
            }

            base.Render(topLeft, bottomRight);

            _speechBubble?.Draw(position * CluwneLib.Camera.PixelsPerMeter,
                                new Vector2(), currentBaseSprite);
        }
        public override void Render(Vector2f topLeft, Vector2f bottomRight)
        {
            if (!visible)
            {
                return;
            }
            if (Owner.GetComponent <TransformComponent>(ComponentFamily.Transform).Position.X < topLeft.X ||
                Owner.GetComponent <TransformComponent>(ComponentFamily.Transform).Position.X > bottomRight.X ||
                Owner.GetComponent <TransformComponent>(ComponentFamily.Transform).Position.Y < topLeft.Y ||
                Owner.GetComponent <TransformComponent>(ComponentFamily.Transform).Position.Y > bottomRight.Y)
            {
                return;
            }

            base.Render(topLeft, bottomRight);

            if (_speechBubble != null)
            {
                _speechBubble.Draw(CluwneLib.WorldToScreen(Owner.GetComponent <TransformComponent>(ComponentFamily.Transform).Position),
                                   new Vector2f(), currentBaseSprite);
            }
        }
        public override void Render(Vector2 topLeft, Vector2 bottomRight)
        {
            if (!visible)
            {
                return;
            }
            if (Owner.GetComponent <TransformComponent>(ComponentFamily.Transform).Position.X < topLeft.X ||
                Owner.GetComponent <TransformComponent>(ComponentFamily.Transform).Position.X > bottomRight.X ||
                Owner.GetComponent <TransformComponent>(ComponentFamily.Transform).Position.Y < topLeft.Y ||
                Owner.GetComponent <TransformComponent>(ComponentFamily.Transform).Position.Y > bottomRight.Y)
            {
                return;
            }

            base.Render(topLeft, bottomRight);

            if (_speechBubble != null)
            {
                _speechBubble.Draw(ClientWindowData.Singleton.WorldToScreen(Owner.GetComponent <TransformComponent>(ComponentFamily.Transform).Position),
                                   Vector2.Zero, currentBaseSprite);
            }
        }
        public virtual void Render(Vector2 topLeft, Vector2 bottomRight)
        {
            UpdateSlaves();

            //Render slaves beneath
            IEnumerable <IRenderableComponent> renderablesBeneath = from IRenderableComponent c in slaves
                                                                    //FIXTHIS
                                                                    orderby c.DrawDepth ascending
                                                                    where c.DrawDepth < DrawDepth
                                                                    select c;

            foreach (IRenderableComponent component in renderablesBeneath.ToList())
            {
                component.Render(topLeft, bottomRight);
            }

            //Render this sprite
            if (!visible)
            {
                return;
            }
            if (sprite == null)
            {
                return;
            }

            var ownerPos = Owner.GetComponent <TransformComponent>(ComponentFamily.Transform).Position;

            Vector2 renderPos = ClientWindowData.Singleton.WorldToScreen(ownerPos);

            SetSpriteCenter(renderPos);

            if (ownerPos.X + sprite.AABB.Right < topLeft.X ||
                ownerPos.X > bottomRight.X ||
                ownerPos.Y + sprite.AABB.Bottom < topLeft.Y ||
                ownerPos.Y > bottomRight.Y)
            {
                return;
            }

            sprite.HorizontalFlip = flip;
            sprite.Draw();
            sprite.HorizontalFlip = false;

            //Render slaves above
            IEnumerable <IRenderableComponent> renderablesAbove = from IRenderableComponent c in slaves
                                                                  //FIXTHIS
                                                                  orderby c.DrawDepth ascending
                                                                  where c.DrawDepth >= DrawDepth
                                                                  select c;

            foreach (IRenderableComponent component in renderablesAbove.ToList())
            {
                component.Render(topLeft, bottomRight);
            }

            //Draw AABB
            var aabb = AABB;

            //CluwneLib.CurrentRenderTarget.Rectangle(renderPos.X - aabb.Width/2, renderPos.Y - aabb.Height / 2, aabb.Width, aabb.Height, Color.Lime);

            if (_speechBubble != null)
            {
                _speechBubble.Draw(ClientWindowData.Singleton.WorldToScreen(Owner.GetComponent <TransformComponent>(ComponentFamily.Transform).Position),
                                   Vector2.Zero, aabb);
            }
        }
Example #6
0
        public virtual void Render(Vector2 topLeft, Vector2 bottomRight)
        {
            UpdateSlaves();

            //Render slaves beneath
            IEnumerable <IRenderableComponent> renderablesBeneath = from IRenderableComponent c in slaves
                                                                    //FIXTHIS
                                                                    orderby c.DrawDepth ascending
                                                                    where c.DrawDepth < DrawDepth
                                                                    select c;

            foreach (IRenderableComponent component in renderablesBeneath.ToList())
            {
                component.Render(topLeft, bottomRight);
            }

            //Render this sprite
            if (!visible)
            {
                return;
            }
            if (sprite == null)
            {
                return;
            }

            var ownerPos = Owner.GetComponent <ITransformComponent>().LocalPosition;

            var renderPos = CluwneLib.WorldToScreen(ownerPos);

            SetSpriteCenter(renderPos.Position);
            var bounds = sprite.TextureRect;

            if (ownerPos.X + bounds.Left + bounds.Width < topLeft.X ||
                ownerPos.X > bottomRight.X ||
                ownerPos.Y + bounds.Top + bounds.Height < topLeft.Y ||
                ownerPos.Y > bottomRight.Y)
            {
                return;
            }

            sprite.HorizontalFlip = HorizontalFlip;
            sprite.Draw(Color);

            //Render slaves above
            IEnumerable <IRenderableComponent> renderablesAbove = from IRenderableComponent c in slaves
                                                                  //FIXTHIS
                                                                  orderby c.DrawDepth ascending
                                                                  where c.DrawDepth >= DrawDepth
                                                                  select c;

            foreach (IRenderableComponent component in renderablesAbove.ToList())
            {
                component.Render(topLeft, bottomRight);
            }

            //Draw AABB
            var aabb = LocalAABB;

            if (_speechBubble != null)
            {
                _speechBubble.Draw(CluwneLib.WorldToScreen(Owner.GetComponent <ITransformComponent>().WorldPosition),
                                   new Vector2(), aabb);
            }
        }