Пример #1
0
        public override void Draw(GraphicsDeviceManager graphics, SpriteBatch spriteBatch, BloomFilter bloomFilter, Board board)
        {
            //GraphicsDevice.SetRenderTarget(renderTarget);


            HiveContracts.Point            firstPoint    = new HiveContracts.Point(0, 0);
            Nullable <HiveContracts.Point> previousPoint = null;

            foreach (var corner in board.Layout.PolygonCorners(Location))
            {
                if (previousPoint.HasValue)
                {
                    spriteBatch.DrawLine(Art.Pixel, corner.ToVector2(), previousPoint.Value.ToVector2(), Color.Red, 3f);
                }
                else
                {
                    firstPoint = corner;
                }

                previousPoint = corner;
            }

            spriteBatch.DrawLine(Art.Pixel, firstPoint.ToVector2(), previousPoint.Value.ToVector2(), Color.Red, 3f);
            var vector2 = board.Layout.HexToPixel(Location);

            spriteBatch.DrawString(Art.ChatFont, $"{Location.q}, {Location.r}, {Location.s}",
                                   new Vector2((float)vector2.X - 20, (float)vector2.Y - 7), Color.Red);
        }
Пример #2
0
        public void Draw(GraphicsDeviceManager graphics, SpriteBatch spriteBatch, BloomFilter bloomFilter, Vector2 location, HiveContracts.Point tileSize)
        {
            var texture = GetTexture();

            spriteBatch.Draw(
                texture,
                location,
                new Rectangle(0, 0, texture.Width, texture.Height),
                Color.White,
                0,
                new Vector2((float)texture.Width / 2, (float)texture.Width / 2),
                new Vector2((float)tileSize.X / (texture.Width), (float)tileSize.Y / (texture.Height)), //Scale
                SpriteEffects.None, 0f);
        }