Пример #1
0
        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="w"></param>
        /// <param name="h"></param>
        public HexPixelMap(int w, int h)
        {
            W = w;
            H = h;
            M = new HexPixel[W, H];

            img = new Bitmap(W * 10, H * 10);

            for (int x = 0; x < W; ++x)
            {
                for (int y = 0; y < H; ++y)
                {
                    this[x, y] = new HexPixel();
                }
            }

            // HexDraw座標点
            {
                double rad;
                double asp   = 0.8;
                double dSize = 8.0;

                for (int i = 0; i < 6; i++)
                {
                    rad = ((double)i * (360.0 / 6.0)) * Math.PI / 180.0;
                    drawHexPoint[i].X = (int)(Math.Sin(rad) * dSize * asp + 0.5);
                    drawHexPoint[i].Y = (int)(Math.Cos(rad) * dSize + 0.5);
                }
            }
        }
Пример #2
0
        int _outOfRange = -1; // 領域外を指定した時の値

        #endregion Fields

        #region Constructors

        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="w"></param>
        /// <param name="h"></param>
        public HexPixelMap(int w, int h)
        {
            W = w;
            H = h;
            M = new HexPixel[W, H];

            img = new Bitmap(W * 10, H * 10);

            for (int x = 0; x < W; ++x)
            {
                for (int y = 0; y < H; ++y)
                {
                    this[x, y] = new HexPixel();
                }
            }

            // HexDraw座標点
            {
                double rad;
                double asp = 0.8;
                double dSize = 8.0;

                for (int i = 0; i < 6; i++)
                {
                    rad = ((double)i * (360.0 / 6.0)) * Math.PI / 180.0;
                    drawHexPoint[i].X = (int)(Math.Sin(rad) * dSize * asp + 0.5);
                    drawHexPoint[i].Y = (int)(Math.Cos(rad) * dSize + 0.5);
                }
            }
        }