コード例 #1
0
        public void SetMonPos(int X, int Y)
        {
            kod.SetHexPos(X, Y, 50);

            txtXMonitor.Text = X.ToString();
            txtYMonitor.Text = Y.ToString();

            txtXHex.Text = kod.dblXhex.ToString();
            txtYHex.Text = kod.dblYhex.ToString();

            txtHexY.Text = kod.intHexY.ToString();
            txtHexX.Text = kod.intHexX.ToString();

            txtYDiff.Text = kod.dblYdiff.ToString("0.00");
        }
コード例 #2
0
        private void BuildHexMap(string strTex)
        {
            string strPetze = "";
              string strZeile = "";

              Texture2D tex = dicTextures[strTex];
              Vector2 vec = new Vector2(0,0);
              clsKoordinaten kod = new clsKoordinaten();

              string strAdr = "";

              vec.X += (0 - tex.Width / 2);
              //vec.X += (0 - tex.Height / 2);
              vec.Y += (0 - tex.Height / 2);
              bool bOffset = false;

              bool blnInit = this.dicHex.Count == 0;

              while (vec.X < graphics.GraphicsDevice.Viewport.Width)
              {
            strZeile = "";

            while (vec.Y < graphics.GraphicsDevice.Viewport.Height)
            {
              SpriteBatchDraw(tex, vec, 1f);

              if (blnInit)
              {
            kod.SetHexPos(Convert.ToInt32(vec.X), Convert.ToInt32(vec.Y), tex);

            strAdr = kod.intHexX.ToString("00") + kod.intHexY.ToString("00");

            strZeile += strAdr + "|";

            if (!dicHex.ContainsKey(strAdr))
            {
              dicHex.Add(strAdr, new clsHexFeld(kod.intXmon, kod.intYmon));
            }
            else
            {
              string str = "X" + strAdr;
            }
              }
              vec.Y += tex.Height;
              if (vec.Y > (tex.Height * 2))
            break;
            }

            vec.X += tex.Width - (tex.Width / 4);
            vec.Y = (bOffset ? 0 - (tex.Height / 2) : 0);

            bOffset = !bOffset;
            strPetze += strZeile + "\n";

            if (vec.X > (tex.Width * 2))
              break;
              }
        }
コード例 #3
0
        private void BuildHexMap(string strTex)
        {
            string strPetze = "";
            string strZeile = "";

            Texture2D      tex = dicTextures[strTex];
            Vector2        vec = new Vector2(0, 0);
            clsKoordinaten kod = new clsKoordinaten();

            string strAdr = "";

            vec.X += (0 - tex.Width / 2);
            //vec.X += (0 - tex.Height / 2);
            vec.Y += (0 - tex.Height / 2);
            bool bOffset = false;

            bool blnInit = this.dicHex.Count == 0;

            while (vec.X < graphics.GraphicsDevice.Viewport.Width)
            {
                strZeile = "";

                while (vec.Y < graphics.GraphicsDevice.Viewport.Height)
                {
                    SpriteBatchDraw(tex, vec, 1f);

                    if (blnInit)
                    {
                        kod.SetHexPos(Convert.ToInt32(vec.X), Convert.ToInt32(vec.Y), tex);

                        strAdr = kod.intHexX.ToString("00") + kod.intHexY.ToString("00");

                        strZeile += strAdr + "|";

                        if (!dicHex.ContainsKey(strAdr))
                        {
                            dicHex.Add(strAdr, new clsHexFeld(kod.intXmon, kod.intYmon));
                        }
                        else
                        {
                            string str = "X" + strAdr;
                        }
                    }
                    vec.Y += tex.Height;
                    if (vec.Y > (tex.Height * 2))
                    {
                        break;
                    }
                }

                vec.X += tex.Width - (tex.Width / 4);
                vec.Y  = (bOffset ? 0 - (tex.Height / 2) : 0);

                bOffset   = !bOffset;
                strPetze += strZeile + "\n";

                if (vec.X > (tex.Width * 2))
                {
                    break;
                }
            }
        }