private void DrawRoute(Point end) { //DRAW MAP for (int y = 0; y < Map.Instance.MAP_HEIGHT; y++) { for (int x = 0; x < Map.Instance.MAP_WIDTH; x++) { var wh = 40d; var pt = new Point(x * wh, y * wh); VisualNode vn = new VisualNode(); vn.Name = $"vnx{x}y{y}"; vn.SetValue(Canvas.LeftProperty, pt.X); vn.SetValue(Canvas.TopProperty, pt.Y); vn.Width = wh; vn.Height = wh; vn.DrawPosition(x, y); vn.SetDot(false); vn.SetWall(Map.Instance.GetMap(x, y)); vn.SetPosition(x, y); vn.NodeClicked += Vn_NodeClicked; cvLayout.Children.Add(vn); } } //START STAR SEARCH THROUGH MAP AStarExample.Start(cvLayout, end); }
private void DrawRoute(Point end) { //DRAW MAP //IXamlDirect xd = XamlDirect.GetDefault(); //var rec = xd.CreateInstance(XamlTypeIndex.Rectangle); //var col = xd.GetXamlDirectObject(cvLayout); for (int y = 0; y < Map.Instance.MAP_HEIGHT; y++) { for (int x = 0; x < Map.Instance.MAP_WIDTH; x++) { var wh = 40d; var pt = new Point(x * wh, y * wh); VisualNode vn = new VisualNode(); vn.Name = $"vnx{x}y{y}"; vn.SetValue(Canvas.LeftProperty, pt.X); //xd.SetObjectProperty(rec, XamlPropertyIndex.Canvas_Left, pt.X); vn.SetValue(Canvas.TopProperty, pt.Y); //xd.SetObjectProperty(rec, XamlPropertyIndex.Canvas_Top, pt.Y); vn.Width = wh; //xd.SetObjectProperty(rec, XamlPropertyIndex.FrameworkElement_Width, wh); vn.Height = wh; //xd.SetObjectProperty(rec, XamlPropertyIndex.FrameworkElement_Height, wh); vn.DrawPosition(x, y); vn.SetDot(false); vn.SetWall(Map.Instance.GetMap(x, y)); vn.SetPosition(x, y); //vn.NodeClicked += Vn_NodeClicked; cvLayout.Children.Add(vn); //xd.AddToCollection(col, rec); } } //START STAR SEARCH THROUGH MAP AStarExample.Start(cvLayout, end); }