示例#1
0
        public static void DrawCursor(Renderer renderer, string cursorName, int2 lastMousePos, int cursorFrame)
        {
            var cursorSequence = GetCursorSequence(cursorName);
            var cursorSprite   = cursorSequence.GetSprite(cursorFrame);

            renderer.SetPalette(palette);
            renderer.SpriteRenderer.DrawSprite(cursorSprite,
                                               lastMousePos - cursorSequence.Hotspot - (0.5f * cursorSprite.size).ToInt2(),
                                               palettes[cursorSequence.Palette],
                                               cursorSprite.size);
        }
示例#2
0
        public static void DrawCursor(Renderer renderer, string cursorName, int2 lastMousePos, int cursorFrame)
        {
            var cursorSequence = GetCursorSequence(cursorName);
            var cursorSprite   = cursorSequence.GetSprite(cursorFrame);

            renderer.SetPalette(Palette);
            renderer.SpriteRenderer.DrawSprite(cursorSprite,
                                               lastMousePos - cursorSequence.Hotspot,
                                               Palette.GetPaletteIndex(cursorSequence.Palette),
                                               cursorSprite.size);
        }
示例#3
0
        public void DrawCursor(Renderer renderer, string cursorName, int2 lastMousePos, int cursorFrame)
        {
            var cursorSequence = GetCursorSequence(cursorName);
            var cursorSprite   = cursorSequence.GetSprite(cursorFrame);
            var cursorSize     = CursorViewportZoomed ? 2.0f * cursorSprite.size : cursorSprite.size;

            var cursorOffset = CursorViewportZoomed ?
                               (2 * cursorSequence.Hotspot) + cursorSprite.size.ToInt2() :
                               cursorSequence.Hotspot + (0.5f * cursorSprite.size).ToInt2();

            renderer.SetPalette(palette);
            renderer.SpriteRenderer.DrawSprite(cursorSprite,
                                               lastMousePos - cursorOffset,
                                               palettes[cursorSequence.Palette],
                                               cursorSize);
        }
示例#4
0
        public void Render(Renderer renderer)
        {
            if (cursor.Name == null || !isLocked)
            {
                return;
            }

            var cursorSequence = cursorProvider.GetCursorSequence(cursor.Name);
            var cursorSprite   = sprites[cursor.Name][frame];

            var cursorOffset = cursorSequence.Hotspot + (0.5f * cursorSprite.Size.XY).ToInt2();

            renderer.SetPalette(hardwarePalette);
            renderer.SpriteRenderer.DrawSprite(cursorSprite,
                                               lockedPosition - cursorOffset,
                                               paletteReferences[cursorSequence.Palette],
                                               cursorSprite.Size);
        }
        public void Render(Renderer renderer)
        {
            if (cursorName == null)
            {
                return;
            }

            var cursorSequence = cursorProvider.GetCursorSequence(cursorName);
            var cursorSprite   = sprites[cursorName][((int)cursorFrame % cursorSequence.Length)];
            var cursorSize     = CursorProvider.CursorViewportZoomed ? 2.0f * cursorSprite.Size : cursorSprite.Size;

            var cursorOffset = CursorProvider.CursorViewportZoomed ?
                               (2 * cursorSequence.Hotspot) + cursorSprite.Size.XY.ToInt2() :
                               cursorSequence.Hotspot + (0.5f * cursorSprite.Size.XY).ToInt2();

            renderer.SetPalette(palette);
            renderer.SpriteRenderer.DrawSprite(cursorSprite,
                                               Viewport.LastMousePos - cursorOffset,
                                               paletteReferences[cursorSequence.Palette],
                                               cursorSize);
        }