Beispiel #1
0
        public void DefaultDraw(Batcher batcher, Rectangle finalBounds)
        {
            var isEmpty = string.IsNullOrEmpty(TextValue);
            var start   = finalBounds.Location.ToVector2() + new Vector2(Padding);

            batcher.DrawRect(finalBounds, PanelColor);

            // Ghost or normal
            if (isEmpty)
            {
                batcher.DrawString(LabelFont, GhostValue, start, FontGhostColor);
            }
            else
            {
                batcher.DrawString(LabelFont, TextValue, start, FontColor);
            }

            if (Manager?.GetFocus() == this)
            {
                if (caretVisible)
                {
                    var end = LabelFont.MeasureString(isEmpty ? "." : TextValue);
                    batcher.DrawLine(start.X + end.X, start.Y, start.X + end.X, start.Y + end.Y, FontColor);
                }
            }
        }
Beispiel #2
0
            public override void Render(Batcher batcher, Camera camera)
            {
                batcher.DrawRect(GameBoard.GetBoardRect(), Constants.LightTile);

                for (int i = 0; i < GameBoard.Instance.Layout.width; i++)
                {
                    for (int j = 0; j < GameBoard.Instance.Layout.height; j++)
                    {
                        if (i % 2 == 0 && j % 2 == 0 || i % 2 != 0 && j % 2 != 0)
                        {
                            continue;
                        }

                        batcher.DrawRect(new Rectangle(
                                             GameBoard.BoardToWorld(new Point(i, j)),
                                             new Point(Constants.CellSize, Constants.CellSize)
                                             ), Constants.DarkTile);
                    }
                }
            }
Beispiel #3
0
            private void DrawPossibleMoves(Batcher batcher)
            {
                if (possibleMoves == null || TurnManager.Instance.selectedCell == null)
                {
                    return;
                }

                foreach (Move m in possibleMoves)
                {
                    batcher.DrawRect(GetCellRectangle(m.targetPosition), new Color(Color.DarkGreen, 0.5f));
                }
            }
        public override void Render(Batcher batcher, Camera camera)
        {
            batcher.DrawHollowRect(Transform.Position, Width, Height, OutlineColour, 6);
            batcher.DrawRect(Transform.Position, Width, Height, BackgroundColour);
            Point offset = new Point(0, -2);

            foreach (var pieceDef in queue)
            {
                offset.Y += pieceDef.height + 1;
                foreach (Point point in pieceDef.shape)
                {
                    Utilities.DrawTile(batcher, point - offset, new Point(padding + Constants.pixelsPerTile, padding + Constants.pixelsPerTile) + Transform.Position.ToPoint(), pieceDef.type);
                }
            }
            batcher.DrawCircle(Transform.Position, 3, Color.Red);
        }
        public override void Render(Batcher batcher, Camera camera)
        {
            batcher.DrawHollowRect(Transform.Position, Width, Height, OutlineColour, 6);
            batcher.DrawRect(Transform.Position, Width, Height, BackgroundColour);
            Point offset = new Point(0, 1);

            if (heldPiece != null)
            {
                foreach (Point point in heldPiece.shape)
                {
                    Utilities.DrawTile(batcher, point - offset, new Point(padding + Constants.pixelsPerTile, padding + Constants.pixelsPerTile) + Transform.Position.ToPoint(), heldPiece.type);
                }
            }

            batcher.DrawCircle(Transform.Position, 3, Color.Red);
        }
        public override void Render(Batcher batcher, Camera camera)
        {
            batcher.DrawCircle(Transform.Position, 2, Color.Red);
            batcher.DrawHollowRect((Transform.Position.RoundToPoint() - new Point(0, height * Constants.pixelsPerTile)).ToVector2(), Width, Height, OutlineColour, 6);
            batcher.DrawRect((Transform.Position.RoundToPoint() - new Point(0, height * Constants.pixelsPerTile)).ToVector2(),
                             Width, Height, BackgroundColour);

            for (int y = 0; y < height + 2; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    DrawGridTile(batcher, new Point(x, y));
                }
            }

            foreach (var player in players)
            {
                var piece = player.piece;
                if (piece != null)
                {
                    var ghost = piece.GetLandedOffset();
                    foreach (Point point in piece.Shape)
                    {
                        DrawOutline(batcher, point + piece.position, player.outlineTint, 6);
                        DrawOutline(batcher, point + piece.position + ghost, player.outlineTint, 6);
                    }
                    foreach (Point point in piece.Shape)
                    {
                        Utilities.DrawTile(batcher, point + piece.position + ghost, Transform.Position.ToPoint(), piece.definition.type, piece.definition.type.ghostColor);
                    }
                    foreach (Point point in piece.Shape)
                    {
                        Utilities.DrawTile(batcher, point + piece.position, Transform.Position.ToPoint(), piece.definition.type);
                    }
                    int temp = 0;
                    foreach (Point point in piece.outline)
                    {
                        Point gridOffset = point + piece.position;
                        Point offset     = new Point(Constants.pixelsPerTile * gridOffset.X, -Constants.pixelsPerTile * gridOffset.Y);
                        batcher.DrawCircle(Transform.Position + offset.ToVector2(), 2, Color.Green);
                        batcher.DrawString(Graphics.Instance.BitmapFont, temp + "", Transform.Position + offset.ToVector2(), Color.White);
                        temp++;
                    }
                }
            }
        }
Beispiel #7
0
                public virtual void DebugRender(Batcher batcher)
                {
                    if (_context.previousNode != null)
                    {
                        batcher.DrawCircle(_context.previousNode.Position, 100, Color.White, 15);
                    }
                    if (_context.currentNode != null)
                    {
                        batcher.DrawCircle(_context.currentNode.Position, 100, Color.Gray, 15);
                    }
                    if (_context.nextNode != null)
                    {
                        batcher.DrawCircle(_context.nextNode.Position, 100, Color.Black, 15);
                    }

                    batcher.DrawRect(GetCheckRectangle(), Color.Black);
                }
Beispiel #8
0
        public virtual void Draw(Batcher batcher, float x, float y, float width, float height, Color color)
        {
            var col = Color ?? color;

            if (color.A != 255)
            {
                col *= (color.A / 255f);
            }
            if (col.A != 255)
            {
                col *= (col.A / 255f);
            }

            if (UseFilledRect)
            {
                batcher.DrawRect(x, y, width, height, col);
            }
            else
            {
                batcher.DrawHollowRect(x, y, width, height, col);
            }
        }
Beispiel #9
0
 public void DefaultDraw(Batcher batcher, Rectangle finalBounds)
 {
     batcher.DrawRect(finalBounds, Color);
 }
Beispiel #10
0
 public void DefaultDraw(Batcher batcher, Rectangle finalBounds)
 {
     realColor = Color.Lerp(realColor, target, 5f * Time.UnscaledDeltaTime);
     batcher.DrawRect(finalBounds, realColor);
     batcher.DrawString(LabelFont, Message, finalBounds.Location.ToVector2() + new Vector2(Padding, Padding), FontColor);
 }