Пример #1
0
        //soundtouch
        //
        //  public void DrawCubo(float x1,float y1,float z1,float x2,float y2,float z2);
        public SharpGLForm()
        {
            Basic_Size = 17;
            MazeCellsIntTab= new int[Basic_Size][];
            for (int j = 0; j < Basic_Size;j++ )
            {
                MazeCellsIntTab[j] = new int[Basic_Size];
            }

                ListaKolizji = new List<Wektor>();
            ListaKolizjiX = new List<float>();
            ListaKolizjiZ = new List<float>();
            MazeCellType = new List<int>();
            rysowM =new RysownikMaze();
            StraightTrap = new TrapChecker();
              //  Sprawdzacz = new SprawdzaczKolizji();
            MyMaze = rysowM.DrawMazeSkelethOfSize(25,true);
            MyMazeTwo = rysowM.DrawMazeSkelethOfSize(Basic_Size,false);
            first_time = false;
            tempMazeList = rysowM.ConvertMazeStructToListOfTypes(MyMazeTwo);

               for(int i=0;i<Basic_Size*Basic_Size;i++)
               {
                   MazeCellsIntTab[i / Basic_Size][i % Basic_Size] = tempMazeList.ElementAt(i);
               }

                KeyA = false;
             KeyS = false; KeyD = false;
             KeyW=false; KeySpace=false;
            WektorZero = new Wektor(0, 0, 0);
            PlayerWektorSpeed = new Wektor(0, 0, 0);
            PlayerLive = 7;
            YAxisCamera = 5;
            CursorWektor = new Wektor(0, 0, 0);
            CursorWektorAngled = new Wektor(0, 0, 0);
            Debug.WriteLine("j");
            Boss = new KwadratBoss(true);
               // new List<int>();
            listaPociskow = new List<KwadratMaterialnyPocisk>();
            listaPociskowPlayera = new List<KwadratMaterialnyPocisk>();
            listaPociskow.Add(new KwadratMaterialnyPocisk(Boss.polozenie, new Wektor(0.1f, 0.0f, -0.13f), 22));
            listaPociskow.Add(new KwadratMaterialnyPocisk(Boss.polozenie, new Wektor(0.09f, 0.0f, -0.03f), 22));
            listaPociskow.Add(new KwadratMaterialnyPocisk(Boss.polozenie, new Wektor(-0.14f, 0.0f, -0.133f), 22));
            for(int i=0 ; i<13 ; i++)
            {
            listaPociskow.Add(new KwadratMaterialnyPocisk(Boss.polozenie,losowyWektorPredkosci(),20));
            }

            cuboPlayer = new kwardratMaterialny(new Wektor(0.0f,0.0f,0.0f),new Wektor(0.0f,0.0f,0.0f),new Wektor(0.4f,0.4f,0.4f),new Wektor(0.2f,0.2f,0.2f),45);
             //       Wektor temp,temp1;
             //       temp = new Wektor(0.0f,0.0f,0.0f);
               //     temp1 = new Wektor(0.2f,0.0f,-0.1f);
            bulletOne = new KwadratMaterialnyPocisk(new Wektor(0.0f, 0.0f, 0.0f),new Wektor(0.2f, 0.0f, 0.03f), 40);
            bulletOne = new KwadratMaterialnyPocisk(new Wektor(0.0f, 0.0f, 0.0f), 30);
            //bulletOne = new KwadratMaterialnyPocisk(temp, temp1, 30);
               // new KwadratMaterialnyPocisk()

            da = new Wektor(1.0f, 1.0f, 1.0f);
            //    Wektor re;
            re = new Wektor(2.0f, 1.0f, 1.0f);

            InitializeComponent();
            this.Controls.Add(openGLControl);

            // this.
            // openGLControl.KeyPress += openGLControl_KeyPress;
            this.openGLControl.KeyPress += new KeyPressEventHandler(keypressed);
            this.openGLControl.KeyDown += new KeyEventHandler(Form2_KeyDown);
            this.openGLControl.KeyUp += new KeyEventHandler(Form1_KeyUp);
            this.openGLControl.MouseClick += Control1_MouseClick;
        }
Пример #2
0
        private void openGLControl_OpenGLDraw(object sender, RenderEventArgs e)
        {
            CursorWektor.X =-1 * ((float)Cursor.Position.X - 680) / 50;
            CursorWektor.Z = -1 * ((float)Cursor.Position.Y - 374) / 50;
             //   double Angle = Math.Atan2(CursorWektor.Z, CursorWektor.X);
            double Angle = -45;
            CursorWektorAngled = rotate_wektor(0, 0, (float)Angle, CursorWektor);
             //   CursorWektorAngled.X = CursorWektor.X * (float)Math.Sin(Angle -ConvertToRadians(90));
             //   CursorWektorAngled.Z = CursorWektor.Z * (float)Math.Cos(Angle -ConvertToRadians(90));

            //  Get the OpenGL object.
            OpenGL gl = openGLControl.OpenGL;
            rysow = new Rysownik(gl);
            rysowM.SetUpGl(gl);

            if (!first_time)
            {
                rysowM.DrawMazeFloor(tempMazeList, 1.0f, new Wektor(0, 0, 0));
                if (rysowM.ListaPointowDoKolizji != null)
                {
                    //   Debug.Write("wwrsdsfsafasfa");
                    ListaKolizji = rysowM.ListaPointowDoKolizji;
                    //   ListaKolizjiX = rysowM.ListaXDoKolizji;
                    //  ListaKolizjiZ = rysowM.ListaZDoKolizji;
                }
                first_time = true;
            }
            Sprawdzacz = new SprawdzaczKolizji(rysow);
             //   rysowM = new RysownikMaze(gl);
            //  Clear the color and depth buffer.
            gl.Clear(OpenGL.GL_COLOR_BUFFER_BIT | OpenGL.GL_DEPTH_BUFFER_BIT);
              //  (x > 0 ? x : (2*PI + x)) * 360 / (2*PI)
                double AngleX;
                AngleX = CursorWektor.X;
               //     if(CursorWektor.X<0){AngleX = (2*Math.PI + CursorWektor.X) * 360 / (2*Math.PI) ;}

                double AngleY;
                AngleY = CursorWektor.Z;
            //    if (CursorWektor.Z < 0) { AngleY = (2 * Math.PI + CursorWektor.Z) * 360 / (2 * Math.PI); }

                Angle_between_wektor_X_Z(WektorZero, CursorWektor);

                     //  Load the identity matrix.
            gl.MatrixMode(OpenGL.GL_PROJECTION);

            //  Load the identity.
            gl.LoadIdentity();
            gl.Perspective(60.0f, 0, 0, 0);
            rysow.DrawLive(new Wektor(0.9f, -0.7f, 0), new Wektor(0.05f, 0.03f, 0f), PlayerLive);
            rysow.DrawLive(new Wektor(-0.9f, -0.7f, 0), new Wektor(0.05f, 0.04f, 0f), Boss.Live);

             //   gl.DepthMask(0);
            //    rysow.DrawCubo(0, 0, 0, 0.33f, 0.33f, 0.33f,0.0f,true,0.6f);
            //    gl.DepthMask(1);
            gl.Enable(SharpGL.OpenGL.GL_SMOOTH);
            gl.Enable(SharpGL.OpenGL.GL_FLAT);

            //    gl.Enable(SharpGL.OpenGL.GL_LINE_SMOOTH);
            //  Create a perspective transformation.
            gl.Perspective(60.0f, (double)Width / (double)Height, 0.01, 100.0);

            //  Use the 'look at' helper function to position and aim the camera.
            gl.LookAt(cuboPlayer.polozenie.X - 5, YAxisCamera, cuboPlayer.polozenie.Z - 5, cuboPlayer.polozenie.X, cuboPlayer.polozenie.Y, cuboPlayer.polozenie.Z, 0, 1, 0);

            //  Rotate around the Y axis.

            float samesize= 2.3f;

            // =new Wektor(1.0, 1.0, 1.0);
            //Wektor re(1.0,1.0,1.0);

             /*       for (int i = 0; i < listaPociskow.Count; i++) // Loop with for.
             {

                 rysow.DrawCubo(listaPociskow[i].polozenie.X, listaPociskow[i].polozenie.Y, listaPociskow[i].polozenie.Z,
                       listaPociskow[i].grubosci.X, listaPociskow[i].grubosci.Y, listaPociskow[i].grubosci.Z, (float)listaPociskow[i].angle + rotation, true,1.0f);

               } */
              //  list
            /*    for (int i = 0; i < listaPociskowPlayera.Count; i++) // Loop with for.
            {

                rysow.DrawCubo(listaPociskowPlayera[i].polozenie.X, listaPociskowPlayera[i].polozenie.Y, listaPociskowPlayera[i].polozenie.Z,
                      listaPociskowPlayera[i].grubosci.X, listaPociskowPlayera[i].grubosci.Y, listaPociskowPlayera[i].grubosci.Z, (float)listaPociskowPlayera[i].angle + rotation, true, 1.0f);

            }
            */

             //   rysow.DrawCubo(Boss.polozenie.X, Boss.polozenie.Y, Boss.polozenie.Z,
              //      Boss.grubosci.X, Boss.grubosci.Y, Boss.grubosci.Z, 20,2);

               // rysow.draw_floor();
             //   rysowM.FinalDrawAllMazeByGl(MyMaze, new Wektor(0, 0, 0),(float)cuboPlayer.angle/15);
              //  rysowM.FinalDrawAllMazeByGl(MyMazeTwo, new Wektor(-2, 0, -3), 0.5f);

              //     rysowM.DrawMazyByListToSpeedUp(tempMazeList,new Wektor(2,0,0),0.02f);
               //    rysowM.drawQuadFloor(new Wektor(1, 0, 1), 1f);

             //      rysowM.drawQuadFloor(new Wektor(0,0,0),1.0f);

               rysowM.DrawMazeFloor(tempMazeList, 1.0f, new Wektor(0, 0, 0));
               int Xo;
               int Yo;
               Coord tempCo = StraightTrap.in_what_coord(cuboPlayer.polozenie.X, cuboPlayer.polozenie.Z, 1.0f);

               Debug.Write(tempCo.x);
            Debug.Write("   y>");
            Debug.WriteLine(tempCo.y);
               if( StraightTrap.is_three_cell_far(MazeCellsIntTab, tempCo.x, tempCo.y))
               {
               Debug.WriteLine("buuummm");
               }
              //      + "  y>" + cuboPlayer.polozenie.Z-1.0f);
              //      gl.EnableClientState(OpenGL.GL_VERTEX_ARRAY);

               //     gl.VertexPointer(0,3,rysowM.ArrayVertex);

              //  gl.VertexPointer()
            //glVertexPointer(3, GL_FLOAT, 0, vertices);

            // draw a cube
               //     gl.DrawArrays(OpenGL.GL_LINES,0,rysowM.count/2);
            //glDrawArrays(GL_TRIANGLES, 0, 36);

            // deactivate vertex arrays after drawing
            //glDisableClientState(GL_VERTEX_ARRAY);
            //        gl.EnableClientState(OpenGL.GL_VERTEX_ARRAY);
              //          gl.DrawArrays()
              //  Debug.WriteLine(ListaKolizji.Count + " <out  ");

               //mapka//    rysowM.DrawMazyByListToSpeedUp(tempMazeList, cuboPlayer.polozenie, 0.22f);

            //   Debug.Write(tempMazeList.Count.ToString() + " ");

            //    rysowM.FinalDrawAllMazeByGl(MyMazeTwo, new Wektor(-5, 0, -5),1+(float)Math.Sin(rotation/10));

              gl.Enable(SharpGL.OpenGL.GL_BLEND);
            gl.BlendFunc(SharpGL.OpenGL.GL_SRC_ALPHA,SharpGL.OpenGL.GL_ONE_MINUS_SRC_ALPHA);

            //           glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
            CursorWektor += cuboPlayer.polozenie;
            rysow.DrawCubo_with_alpha(CursorWektor.X, CursorWektor.Y, CursorWektor.Z,
                cuboPlayer.grubosci.X,
                cuboPlayer.grubosci.Y, cuboPlayer.grubosci.Z, rotation * 2,0.3f);
            CursorWektorAngled += cuboPlayer.polozenie;
               // rysow.DrawCubo_with_alpha(CursorWektorAngled.X, CursorWektorAngled.Y, CursorWektorAngled.Z,
               ////         cuboPlayer.grubosci.X,
              //          cuboPlayer.grubosci.Y * 3, cuboPlayer.grubosci.Z, (float)(1.5 * -1) * rotation, 0.3f);

            cuboPlayer.angle = -1f * Angle_between_wektor_X_Z(cuboPlayer.polozenie, CursorWektor);

            rysow.DrawPlayer(cuboPlayer.polozenie, cuboPlayer.grubosci, cuboPlayer.angle);

              //  rysow.DrawCubo_with_alpha(CursorWektorAngled.X,CursorWektorAngled.Y,CursorWektorAngled.Z,
              //      cuboPlayer.grubosci.X,
            //        cuboPlayer.grubosci.Y*3, cuboPlayer.grubosci.Z,  (float)(1.5 * -1) * rotation ,0.3f);

            Wektor AngleZeto;
            AngleZeto = new Wektor(120, 31200, 2130);
            //
             //   trete

            //player config
            int hour_0_to_7;
            hour_0_to_7 = 900000;

            if (KeyW && !KeyA && !KeyD && !KeyS)
            {
                hour_0_to_7 = -1;
            }
            if (!KeyW && !KeyA && !KeyD && KeyS)
            {
                hour_0_to_7 = 4;
            }

            if (!KeyW && KeyA && !KeyD && !KeyS)
            {
                hour_0_to_7 = 6;
            }
            if (!KeyW && !KeyA && KeyD && !KeyS)
            {
                hour_0_to_7 = 2;
            }

            if (KeyA && KeyS && !KeyW)
            {
                hour_0_to_7 = 5;
            }
            if (KeyS && KeyD && !KeyW)
            {
                hour_0_to_7 = 3;
            }
            if (KeyD && KeyW)
            {
                hour_0_to_7 = 1;
            }
            if (KeyW && KeyA)
            {
                hour_0_to_7 = 7;
            }

            Wektor temp;
            temp = new Wektor(0.0f, 0.0f, 0.2f);
            if (Math.Abs(cuboPlayer.predkosc.X) < 0.2f && Math.Abs(cuboPlayer.predkosc.Z) < 0.2f)
            {

                switch (hour_0_to_7)
                {
                    case -1:

                        cuboPlayer.predkosc = RotateWektorOnZero(temp, 315);
                        break;
                    case 1:

                        cuboPlayer.predkosc = temp;
                        //      cuboPlayer.predkosc.Z += 0.21f;
                //        Debug.WriteLine(RotateWektorOnZero(temp, 45).X + "   " + RotateWektorOnZero(temp, 45).Z);
                        break;
                    case 2:
                        cuboPlayer.predkosc = RotateWektorOnZero(temp, 45);
                        //cuboPlayer.predkosc.Z += RotateWektorOnZero(temp, 90).Z;
                    //    Debug.WriteLine(RotateWektorOnZero(temp, 90).X + "   " + RotateWektorOnZero(temp, 90).Z);
                        break;

                    case 3:
                        cuboPlayer.predkosc = RotateWektorOnZero(temp, 90);
                        break;
                    case 4:
                        cuboPlayer.predkosc = RotateWektorOnZero(temp, 135);
                        break;
                    case 5:
                        cuboPlayer.predkosc = RotateWektorOnZero(temp, 180);
                        break;
                    case 6:
                        cuboPlayer.predkosc = RotateWektorOnZero(temp, 225);
                        break;
                    case 7:
                        cuboPlayer.predkosc = RotateWektorOnZero(temp, 270);
                        break;
                    // default:
                    //        cuboPlayer.wycisz_predkosc_only_XZ_o(0.1f);

                }
            }

            cuboPlayer.wycisz_predkosc_only_XZ_o(0.01f);
             //   if(Sprawdzacz.CzyNieKoliduje(ListaKolizji,1.0f,cuboPlayer.polozenie + cuboPlayer.predkosc)){

            if (ListaKolizji != null)
            {
              //      Debug.Write(ListaKolizji.Count);
             //   Debug.Write("nie pusty");
               if(Sprawdzacz.CzyNieKoliduje(ListaKolizji,0.5f,cuboPlayer.polozenie+cuboPlayer.predkosc))
               {
                    cuboPlayer.krok_naprzod();
               }
            }

            //esle

            if (bulletOne != null) { bulletOne.krok_naprzod(); }

            Boss.krok_naprzod();
              //      foreach (KwadratMaterialnyPocisk prime in listaPociskow) // Loop through List with foreach.
             //       {
            //           prime.krok_naprzod();
            //        }
            for (int i = 0; i < listaPociskow.Count; i++) // Loop with for.
            {
                if (listaPociskow[i].vitality < 1)
                {
                    listaPociskow.RemoveAt(i);
                }
                else
                {
                    listaPociskow[i].krok_naprzod();
                }

            }

            //foreach (KwadratMaterialnyPocisk prime in listaPociskowPlayera) // Loop through List with foreach.
            //{
            //    if (prime.vitality < 3)
            //    {
            //        listaPociskowPlayera.Remove(prime);
            //    }
            //    else
            //    {
            //        prime.krok_naprzod();
            //    }
            //}

            for (int i = 0; i < listaPociskowPlayera.Count; i++) // Loop with for.
            {
                if(czy_nachodza(listaPociskowPlayera[i].polozenie,Boss.polozenie,Boss.grubosci.X))
                {
                    Boss.Live--;
                  //  Debug.WriteLine("nachodza");
                }

                if (listaPociskowPlayera[i].vitality < 3)
                {
                    listaPociskowPlayera.RemoveAt(i);
                }
                else
                {
                    listaPociskowPlayera[i].krok_naprzod();
                }

            }

            if (cuboPlayer.polozenie.X < 2.0f * 16 * 3 && -5.5f + (2.0f * 16 * 3) < cuboPlayer.polozenie.Z && -5.5f + (2.0f * 16 * 3) < cuboPlayer.polozenie.X                )
            {
                ListaKolizji = new List<Wektor>();
                ListaKolizjiX = new List<float>();
                ListaKolizjiZ = new List<float>();
                MazeCellType = new List<int>();
                rysowM = new RysownikMaze();
             //   Sprawdzacz = new SprawdzaczKolizji();
                MyMaze = rysowM.DrawMazeSkelethOfSize(25, true);
                MyMazeTwo = rysowM.DrawMazeSkelethOfSize(16, false);
                //
                tempMazeList = rysowM.ConvertMazeStructToListOfTypes(MyMazeTwo);

                cuboPlayer.polozenie = new Wektor(0, 0, 0);
            }

            if( cuboPlayer.polozenie.X > 2.0f * 16)
            {

            }

            if(Boss.counter%100  == 0)
            {
                Boss.Live--;
                if(Boss.Live==0)
                {
                    cuboPlayer.polozenie = new Wektor(0, 0, 0);
                }
                listaPociskow = new List<KwadratMaterialnyPocisk>();
                for (int i = 0; i < 13; i++)
                {
                    listaPociskow.Add(new KwadratMaterialnyPocisk(Boss.polozenie, losowyWektorPredkosci(), 20));
                }

            }

               // cuboOne.daj_kat_kwadrata();
            //  Nudge the rotation.
            rotation += 3.0f;
            Wektor inc;
            inc = new Wektor(0.01f, 0.0f, 0.0f);
            da += inc;
               re= re * 1.01f;
               if (bulletOne != null)
               {
               if (bulletOne.vitality < 0)
               {
                   bulletOne = null;
               }
               }
        }
        public MazeStruct DrawMazeSkelethOfSize(int MazeSize,bool is_fivedirect)
        {
            EdgeWeightedGraph MazeBasic = new EdgeWeightedGraph(MazeSize * MazeSize);
                //  int tab[25];
                Random rand;
                rand = new Random();
                int xRand = rand.Next();
                for (int i = 0; i < MazeSize; i++)
                {
                    for (int j = 0; j < MazeSize; j++)
                    {
                        //  for(int x=0;x<4;x++)
                        int dest = ((i + 1) * MazeSize) + j;
                        if (i + 1 < MazeSize)
                        {
                            xRand = (rand.Next() % 6) + 1;
                            Edge tempEdge = new Edge(i * MazeSize + j, dest, xRand);
                            MazeBasic.AddEdge(tempEdge);
                        }

                        dest = ((i - 1) * MazeSize) + j;
                        if (i - 1 >= 0)
                        {
                            xRand = (rand.Next() % 6) + 1;
                            Edge tempEdge = new Edge(i * MazeSize + j, dest, xRand);
                            MazeBasic.AddEdge(tempEdge);
                        }

                        dest = (i * MazeSize) + (j + 1);
                        if (j + 1 < MazeSize)
                        {
                            xRand = (rand.Next() % 6) + 1;
                            Edge tempEdge = new Edge(i * MazeSize + j, dest, xRand);
                            MazeBasic.AddEdge(tempEdge);
                        }

                        dest = (i * MazeSize) + (j - 1);
                        if (j - 1 >= 0)
                        {
                            xRand = (rand.Next() % 6) + 1;
                            Edge tempEdge = new Edge(i * MazeSize + j, dest, xRand);
                            MazeBasic.AddEdge(tempEdge);
                        }

                        if (is_fivedirect)
                        {
                            dest = ((i + 1) * MazeSize) + (j + 1);
                            if (j + 1 < MazeSize && i + 1 < MazeSize)
                            {
                                xRand = (rand.Next() % 6) + 1;
                                Edge tempEdge = new Edge(i * MazeSize + j, dest, xRand);
                                MazeBasic.AddEdge(tempEdge);
                            }
                        }

                    }
                }

                PrimMST MazeBasicTree = new PrimMST(MazeBasic);
                //   MazeBasicTree.Edges
                Queue<Edge> MazeDone = new Queue<Edge>();
               // Queue<Edge> MazeDone = new Queue<Edge>();

              //  int sorc, desto;
              //  String writelienString;
                MazeStruct MazeToReturn;
                MazeToReturn = new MazeStruct(MazeSize* MazeSize);
                foreach (Edge s in MazeBasicTree.Edges())
                {

                    // Debug.WriteLine( s.Target.  +"  ");

                    MazeToReturn.setUpByEdge(s,true);

                }
                return MazeToReturn;
        }
        public List<int> ConvertMazeStructToListOfTypes(MazeStruct MazeTemp)
        {
            int x,y;
                List<int> tempList;
                tempList = new List<int>();
                bool up, down, left, right;
                int ofType;
                ofType = 10000;

              //  tempString = "0000";
                int target_x= 0;
                int target_y= 0;
                 int InitialSize = (int)Math.Sqrt( (double)MazeTemp.SizeOfMaze);
                // Debug.WriteLine(InitialSize);
                for(int i = 0;i < MazeTemp.SizeOfMaze;i++)
                {
              //                          x = i / InitialSize;
              //      y = i % InitialSize;
                    x = i / InitialSize;
                    y = i % InitialSize;
                     var temp = MazeTemp.TableOfMazes.Find(r => (r.VertexNumber == i));

                    //kurde find nieraz zwraca tempa bez sasiadow ...
             //        Debug.WriteLine(temp.Neigboors.Count);
                     up = down = left = right = false;
                    //if work is fine
                    foreach (int vertex in temp.Neigboors)
                    {
                        Debug.WriteLine(i + " >>" + vertex);
                     //   target_x = vertex / InitialSize;
                 //       target_y = vertex % InitialSize;
                        target_x = vertex / InitialSize;
                        target_y = vertex % InitialSize;

                        if(target_x == x)
                        {
                            if(target_y > y)
                            {
                                up = true;
                              //  tempString[0] = '1';
                                ofType += 1000;
                            }
                            else
                            {
                                down = true;
                               // tempString[2] = '1';
                                ofType += 10;
                            }

                        }
                        else
                        {
                            if(target_x > x)
                            {
                                right = true;
                                ofType += 100;
                             //   tempString[1] = '1';
                            }
                            else
                            {
                                left = true;
                                ofType += 1;
                              //  tempString[3] = '1';
                            }
                        }

                      //awesome schiz //  target_y = vertex / InitialSize;

                    } //foreach

                 //   Debug.WriteLine(ofType);

                    if (ofType != 10000)
                    {
                        tempList.Add(ofType);
                       // Debug.WriteLine("sasiaz z" + ofType + " o numerze " + i);
                    }

                    ofType = 10000;

                    //      temp.Neigboors.Add(TempEdge.Dest());
                }

                return tempList;
        }
        public void FinalDrawAllMazeByGl(MazeStruct MazeTemp,Wektor Center,float Weight_of_cell)
        {
            int x;
                int target_x;
                int target_y;
                float weight;
                float weight_with_size;
                weight = Weight_of_cell;
                int y;
                Wektor Cursor;
                Wektor DrawableCursor;
                //Cursor = Center;
                weight_with_size = weight * MazeTemp.SizeOfMaze;
                Cursor = new Wektor(Center.X - (weight_with_size / 2), Center.Y - (weight_with_size / 2), Center.Z - (weight_with_size / 2));
                DrawableCursor = Cursor;
                int InitialSize = (int)Math.Sqrt( (double)MazeTemp.SizeOfMaze);
                gl.PushMatrix();
                gl.Begin(OpenGL.GL_LINES);
                gl.Color(0.44f, 0.44f, 0.44f);
                for(int i = 0;i < MazeTemp.SizeOfMaze;i++)
                {
                    x = i / InitialSize;
                    y = i % InitialSize;
                    DrawableCursor.X = Cursor.X+ ( x * weight);
                    DrawableCursor.Z = Cursor.Z + (y * weight);
                    var temp = MazeTemp.TableOfMazes.Find(r => (r.VertexNumber == i));
                //    Debug.Write(i);
                 //   Debug.WriteLine(temp.Neigboors.Count + "  nawet raz nei jest pusty");
                    foreach (int vertex in temp.Neigboors)
                    {

                   //     Debug.Write(" >>>" + vertex);
                        target_x = vertex / InitialSize;
                      //awesome schiz //  target_y = vertex / InitialSize;
                        target_y = vertex % InitialSize;

                   //     gl.Color(0.57f, 0.52f, 0.59f);
                    //    gl.Vertex(DrawableCursor.X, Center.Y, DrawableCursor.Z);
                 //       gl.Vertex(Cursor.X, Cursor.Y, Cursor.Z);
                     //   gl.Vertex(Cursor.X + (target_x * weight), 0 , Cursor.Z + (target_y * weight));
                        gl.Vertex(Center.X+ (target_x* weight ), Center.Y, Center.Z + (target_y * weight));
                        gl.Vertex(Center.X + (x * weight),Center.Y,Center.Z + (y * weight));

                    }
                 //   Debug.WriteLine(" ");
                    //      temp.Neigboors.Add(TempEdge.Dest());
                }
                gl.End();
                gl.PopMatrix();
        }