Beispiel #1
0
 private HexRender()
 {
     _r = GlobalConst.DEFAULT_r;
     _a = 2.0 / Math.Sqrt(3.0) * _r;
     hexGrid = HexGrid.I;
     polygon = new Polygon() { IsEnabled = false };
     for (int i = 0; i < 6; i++) polygon.Points.Add(new Point());
 }
Beispiel #2
0
        public MainBlackBoard()
        {
            this.ClipToBounds = true;

            //Binding to KeyBoardEvents
            this.Focusable = true;
            Loaded += (sender, e) => Keyboard.Focus(this);

            SizeChanged += OnSizeChanged;

            hexGrid = new HexGrid(Children, OnSelected);
            map = new Map(OnMapChanged);
        }
Beispiel #3
0
        public HexGrid(UIElementCollection ui, Action<List<Point>> onSelected)
        {
            _i = this;

            this.real_r = GlobalConst.DEFAULT_r;
            this.real_a = 2.0 / Math.Sqrt(3) * real_r;
            this.worldOrigin = new Point(0, 0);
            this.ui = ui;

            selectableHex = new HexRender(DisplayType.FUNC_Selectable);

            ui.Add(selectableHex);

            this.onSelected = onSelected;

            hexPen = new Pen
            {
                Brush = Brushes.BlueViolet,
                Thickness = 2,
                StartLineCap = PenLineCap.Round,
                EndLineCap = PenLineCap.Round
            };
        }