Beispiel #1
0
        public void Draw(DrawContext ctx)
        {
            if (Empty)
            {
                return;
            }
            float xOff = 0.0f;
            float x, y;
            bool  underCursor = false;

            if (!Hard && row == pane.CursorRow)
            {
                if (column == pane.CursorColumn)
                {
                    underCursor = true;
                    xOff        = -3.0f;
                }
                else if (column == pane.CursorColumn + 1)
                {
                    underCursor = true;
                    xOff        = 3.0f;
                }
            }

            float angle = underCursor
                ? pane.Jitter * 30.0f
                : (float)Math.Sin(pane.Jitter * jiggle) * 3.0f;

            ctx.Push();
            if (animationStep >= 0.0f)
            {
                x = animationSourceX + (BlockX - animationSourceX) * animationStep;
                y = animationSourceY + (BlockY - animationSourceY) * animationStep;
            }
            else
            {
                x = BlockX;
                y = BlockY;
            }
            ctx.Translate(x + xOff, y);
            ctx.RotateAroundPoint(angle, pane.BlockSize / 2, pane.BlockSize / 2);
            if (underCursor)
            {
                float scale = 1.35f * (1.0f - (float)Math.Sin(pane.Jitter * 3.0f) * 0.06f);
                ctx.ScaleAroundPoint(scale, scale, pane.BlockSize / 2, pane.BlockSize / 2);
            }
            block.Draw(ctx, pane, 1.0f);
            ctx.Pop();
        }