当前位置: 首页>>代码示例>>C#>>正文


C# Mapping.GetHexTopLeftCorner方法代码示例

本文整理汇总了C#中Mapping.GetHexTopLeftCorner方法的典型用法代码示例。如果您正苦于以下问题:C# Mapping.GetHexTopLeftCorner方法的具体用法?C# Mapping.GetHexTopLeftCorner怎么用?C# Mapping.GetHexTopLeftCorner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mapping的用法示例。


在下文中一共展示了Mapping.GetHexTopLeftCorner方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EditorControl

        public EditorControl(Map mapToEdit, MainWindow mainWindow)
        {
            InitializeComponent();
            Map = mapToEdit;
            MainWnd = mainWindow;
            Mapping = new Mapping(50, 42);
            this.DataContext = Map;
            ViewPortData viewPort = new ViewPortData() { CentreX = 0, CentreY = 0, Height = 500, Width = 500, Zoom = 1 };

            //var uriSource = new Uri(@"/WpfApplication1;component/Untitled.png", UriKind.Relative);
            //foo.Source = new BitmapImage(uriSource);
            BitmapImage img = new BitmapImage(new Uri("C:/Development/projects/Landwar/Shared/HexRed.png"));

            /*ImageBrush imgBrush = new ImageBrush(img);
            imgBrush.Viewbox = new Rect(0, 0, 1, 1);
            imgBrush.ViewboxUnits = BrushMappingMode.RelativeToBoundingBox;
            imgBrush.Stretch = Stretch.Uniform;*/

            SolidColorBrush redSolidColorBrush = new SolidColorBrush();
            redSolidColorBrush.Color = Color.FromArgb(255, 255, 0, 0);
            SolidColorBrush grnSolidColorBrush = new SolidColorBrush();
            grnSolidColorBrush.Color = Color.FromArgb(255, 0, 255, 0);

            for (int j = 0; j < mapToEdit.Height; ++j)
            {
                for (int i = 0; i < mapToEdit.Width; ++i)
                {
                    Point hexTopLeft = Mapping.GetHexTopLeftCorner(viewPort, mapToEdit.Hexes[j,i]);

                    Polygon pGon = GenerateHex(hexTopLeft.X, hexTopLeft.Y, Mapping.hexHeight, Mapping.hexWidth);
                    pGon.Stroke = Brushes.Purple;
                    pGon.StrokeThickness = 0;
                    pGon.ClipToBounds = true;
                    //pGon.Fill = imgBrush;

                    if (((double)i) % 2 == 0)
                    {
                        pGon.Fill = redSolidColorBrush;
                    }
                    else
                    {
                        pGon.Fill = grnSolidColorBrush;
                    }

                    pGon.MouseEnter += Polygon_MouseMove;

                    this.cnvMap.Children.Add(pGon);
                }
            }
        }
开发者ID:johnburgato,项目名称:Landwar,代码行数:50,代码来源:EditorControl.xaml.cs


注:本文中的Mapping.GetHexTopLeftCorner方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。