Beispiel #1
0
 protected override void AfterDraw(RendererBatch batch)
 {
     batch.Configure(transformMatrix: Camera.Matrix);
     batch.Begin();
     Tools.Font.Draw(batch, Player.Position.ToString(), Vector2.One * 8, new Vector2(32, 8));
     batch.End();
 }
Beispiel #2
0
        protected override void AfterDraw(RendererBatch batch)
        {
            var display = Runner.Application.Size.ToVector2();
            var offset  = display - Vector2.One * 17f;
            var size    = Vector2.One * 16f;

            batch.Configure(transformMatrix: Camera.Matrix);
            batch.Begin();
            batch.DrawPrimitives(b =>
            {
                b.DrawRectangle(Vector2.Zero, size, Color.Red);
                b.DrawRectangle(Vector2.UnitX * offset.X, size, Color.Yellow);
                b.DrawRectangle(Vector2.UnitY * offset.Y, size, Color.LimeGreen);
                b.DrawRectangle(offset, size, Color.Cyan);
            });
            batch.End();
        }
        protected override void AfterDraw(RendererBatch batch)
        {
            batch.Configure(transformMatrix: Camera.Matrix);
            batch.Begin();

            foreach (var shape in _shapes)
            {
                var color = Color.Red;

                if (shape == _shapeSelected)
                {
                    if (_isColliding)
                    {
                        color = Color.Yellow;
                    }
                    else if (_isDragging)
                    {
                        color = Color.Magenta;
                    }

                    if (_isColliding)
                    {
                        var lastPos = shape.Position;

                        foreach (var result in _manifolds)
                        {
                            shape.Position = lastPos + result.Translation;
                            shape.Draw(batch, Color.Blue);
                        }

                        shape.Position = lastPos;
                    }
                }

                shape.Draw(batch, color);
            }

            if (_isRaycasting)
            {
                batch.DrawPrimitives(p =>
                {
                    var color = _isRayHit
                        ? Color.Cyan
                        : Color.Blue;

                    p.DrawLine(_rayStart, _rayEnd, color);

                    if (_isRayHit)
                    {
                        foreach (var result in _raycasts)
                        {
                            var projection = result.Contact + result.Normal * result.Depth;
                            p.DrawLine(result.Contact, projection, Color.Lime);
                            p.DrawDot(result.Contact, Color.Yellow);
                            p.DrawCircle(result.Contact, 3f, Color.Yellow);
                        }
                    }
                });
            }

            batch.End();
        }