Esempio n. 1
0
        public static HexCoordinate GetTopLeftCoordinateToCenter(HexCoordinate centerCoordinate, Rectangle mapArea)
        {
            var newTopLeftCorner      = centerCoordinate.Minus(new HexCoordinate(mapArea.Width / 2, mapArea.Height / 2));
            var adjustedTopLeftCorner = ConvertToValidTopLeftCoordinate(newTopLeftCorner);

            return(adjustedTopLeftCorner);
        }
        protected override void DrawHex(Graphics graphics, Hex hex, int alpha)
        {
            HexCoordinate selectedCoordinate = hex.Coordinate;

            if (selectedCoordinate != null)
            {
                HexCoordinate positionOnVisibleMap   = selectedCoordinate.Minus(UiInterface.GetMapBox().TopLeftCoordinate);
                Point         positionOnScreen       = PositionManager.HexToScreen(positionOnVisibleMap);
                var           pictureLocationAndSize = new Rectangle(positionOnScreen, new Size(50, 44));

                using (var selectImage = Image.FromFile("Images/SelectBorder.png"))
                {
                    graphics.DrawImage(selectImage, pictureLocationAndSize);
                }
            }
        }
Esempio n. 3
0
        public static Point HexToScreen(HexCoordinate hexCoordinate, HexCoordinate topLeftCoordinate)
        {
            HexCoordinate positionOnVisibleMap = hexCoordinate.Minus(topLeftCoordinate);

            return(HexToScreen(positionOnVisibleMap));
        }