예제 #1
0
        public IRenderable[] RenderUI(int2 pos, WVec offset, int zOffset, PaletteReference palette, float scale)
        {
            var imagePos        = pos - new int2((int)(scale * Image.Size.X / 2), (int)(scale * Image.Size.Y / 2));
            var imageRenderable = new UISpriteRenderable(Image, WPos.Zero + offset, imagePos, CurrentSequence.ZOffset + zOffset, palette, scale);

            if (CurrentSequence.ShadowStart >= 0)
            {
                var shadow           = CurrentSequence.GetShadow(CurrentFrame, facingFunc());
                var shadowPos        = pos - new int2((int)(scale * shadow.Size.X / 2), (int)(scale * shadow.Size.Y / 2));
                var shadowRenderable = new UISpriteRenderable(shadow, WPos.Zero + offset, shadowPos, CurrentSequence.ShadowZOffset + zOffset, palette, scale);
                return(new IRenderable[] { shadowRenderable, imageRenderable });
            }

            return(new IRenderable[] { imageRenderable });
        }
예제 #2
0
        public IRenderable[] RenderUI(WorldRenderer wr, int2 pos, WVec offset, int zOffset, PaletteReference palette, float scale = 1f)
        {
            scale *= CurrentSequence.Scale;
            var screenOffset    = (scale * wr.ScreenVectorComponents(offset)).XY.ToInt2();
            var imagePos        = pos + screenOffset - new int2((int)(scale * Image.Size.X / 2), (int)(scale * Image.Size.Y / 2));
            var imageRenderable = new UISpriteRenderable(Image, WPos.Zero + offset, imagePos, CurrentSequence.ZOffset + zOffset, palette, scale);

            if (CurrentSequence.ShadowStart >= 0)
            {
                var shadow           = CurrentSequence.GetShadow(CurrentFrame, facingFunc());
                var shadowPos        = pos - new int2((int)(scale * shadow.Size.X / 2), (int)(scale * shadow.Size.Y / 2));
                var shadowRenderable = new UISpriteRenderable(shadow, WPos.Zero + offset, shadowPos, CurrentSequence.ShadowZOffset + zOffset, palette, scale);
                return(new IRenderable[] { shadowRenderable, imageRenderable });
            }

            return(new IRenderable[] { imageRenderable });
        }