Exemplo n.º 1
0
 //int x, int y, int ID, int height, int depth
 private void boje_moy(int[] x, int xp, int yp)
 {
     switch (x[0])
     {
         case 0:
             map_mass[xp, yp] = new Pixel_space(new Point(xp, yp));
             break;
         case 1:
             map_mass[xp, yp] = new Terrain(new Point(xp, yp), x[1]);
             break;
         case 2:
             map_mass[xp, yp] = new Water(new Point(xp, yp));
             break;
         case 3:
             map_mass[xp, yp] = new Coast(new Point(xp, yp), x[2]);
             break;
         case 4:
             map_mass[xp, yp] = new Mountain(new Point(xp, yp));
             break;
     }
 }
Exemplo n.º 2
0
 private void Map_Paint(object sender, PaintEventArgs e)
 {
     if (mass_existense)
     {
         Pixel cleaner = new Pixel_space();
         if (Tb_mapsize.TextLength != 0) _map_size = Convert.ToInt32(Tb_mapsize.Text);
         if(_map_size <= 256 && _map_size >=5)
         {
             Graphics G = e.Graphics;
             vcoord = (map_size - picture_size) * Vscroll.Value / 100;
             hcoord = (map_size - picture_size) * Hscroll.Value / 100;
             for (int x = 0 ; x < picture_size; x++)
             {
                 for (int y = 0; y < picture_size; y++)
                 {
                     cleaner.create(G, x, y);
                 }
             }
             int size;
             if (picture_size > map_size) size = map_size;
             else size = picture_size;
             for (int x = 0 + hcoord; x < size + hcoord; x++)
             {
                 for (int y = 0 + vcoord; y < size + vcoord; y++)
                 {
                     int boje = x - hcoord;
                     int moy = y - vcoord;
                     map_mass[x, y].create(G,boje, moy);
                 }
             }
             if (map_size > picture_size)
             {
                 Vscroll.Enabled = true;
                 Hscroll.Enabled = true;
             }
             else
             {
                 Vscroll.Enabled = false;
                 Hscroll.Enabled = false;
             }
         }
     }
 }