예제 #1
0
        //soundtouch
        //
        //  public void DrawCubo(float x1,float y1,float z1,float x2,float y2,float z2);
        public SharpGLForm()
        {
            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);
            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
        //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;
        }
예제 #3
0
        private void keypressed(Object o, KeyPressEventArgs e)
        {
            // The keypressed method uses the KeyChar property to check
            // whether the ENTER key is pressed.
              //  Debug.WriteLine("dsadsadas");

            // If the ENTER key is pressed, the Handled property is set to true,
            // to indicate the event is handled.
            /*

            if (e.KeyChar == (char)Keys.W)
            {
                e.Handled = true;
                Debug.WriteLine("WWWWW");
            }
            if((char)e.KeyChar == 'w')
            {
                Debug.WriteLine("wwwwww");
                cuboPlayer.predkosc.X = 0.2f;
               // cuboPlayer.predkosc.Z = 0.0f;
            }

            if ((char)e.KeyChar == 's')
            {
                Debug.WriteLine("sss");
                cuboPlayer.predkosc.X = -0.2f;
               // cuboPlayer.predkosc.Z = 0.0f;
            }

            if ((char)e.KeyChar == 'a')
            {
                Debug.WriteLine("aaaaa");
                cuboPlayer.predkosc.Z = -0.2f;
               //     cuboPlayer.predkosc.X = 0.0f;
            }

            if ((char)e.KeyChar == 'd')
            {
                Debug.WriteLine("ddddd");
                cuboPlayer.predkosc.Z = 0.2f;

            }
            */
             //   ContextStaticAttribute double yAxisCamera;
             //   double yAxisCamera;

            if ((char)e.KeyChar == 'p')
            {

                //rysowM.DrawMaze();
                //rysowM.DrawMazeOfSize(1009);
               //         Wektor POP;
               //         Wektor temp;
               //         POP = new Wektor(2, 2, 2);
               //         temp = POP;
               //     Debug.WriteLine(POP.X + ":x " + POP.Z +":z ");
             //   POP = rotate_wektor(0, 0, 180, POP);
            //    POP = RotateWektorOnZero(POP, 180);
              ///      Debug.WriteLine(POP.X + ":x after " + POP.Z + ":z af");
             //       POP = RotateWektorOnZero(POP, 90);
             ///       Debug.WriteLine(POP.X + ":x after " + POP.Z + ":z af");
             ///       POP = RotateWektorOnZero(POP, 45);
            ///        Debug.WriteLine(POP.X + ":x after " + POP.Z + ":z af");
            ///        POP = RotateWektorOnZero(POP, 45);
             ///       Debug.WriteLine(POP.X + ":x after " + POP.Z + ":z af");

                Debug.WriteLine("PPPPPP");
                cuboPlayer.predkosc.Z = 0.1f;
                cuboPlayer.predkosc.X = 0.0f;
                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);
                bulletOne = new KwadratMaterialnyPocisk(new Wektor(0.0f, 0.0f, 0.0f), new Wektor(0.1f, 0.0f, 0.03f), 40);
                bulletOne = new KwadratMaterialnyPocisk(new Wektor(0.0f, 0.0f, 0.0f), 30);
                OpenGL gl = openGLControl.OpenGL;
                YAxisCamera += 0.4;
              //  gl.LookAt(-5, YAxisCamera, -5, 0, 0, 0, 0, 1, 0);
            }
            if ((char)e.KeyChar == 'l')
            {

            //    MazeStruct TestMaze;
            //    TestMaze = new MazeStruct(5);
            //    TestMaze.setUpByEdge(new Edge(1, 2, 55));
            //    TestMaze.setUpByEdge(new Edge(2, 1, 674));
            //    TestMaze.setUpByEdge(new Edge(4, 5, 674));

               // TestMaze.setUpByEdge(new)
            //    TestMaze.viewByDebug();
              //      Debug.WriteLine("PPPPPP");
              //  cuboPlayer.predkosc.Z = 0.1f;
              //  cuboPlayer.predkosc.X = 0.0f;
             //   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);
              //  bulletOne = new KwadratMaterialnyPocisk(new Wektor(0.0f, 0.0f, 0.0f), new Wektor(0.1f, 0.0f, 0.03f), 40);
              //  bulletOne = new KwadratMaterialnyPocisk(new Wektor(0.0f, 0.0f, 0.0f), 30);
              //  OpenGL gl = openGLControl.OpenGL;
                YAxisCamera -= 0.4;
                //  gl.LookAt(-5, YAxisCamera, -5, 0, 0, 0, 0, 1, 0);
            }
              //  YAxisCamera += 0.05;
            if (e.KeyChar == (char)Keys.E)
            {
                e.Handled = true;
             //       Debug.WriteLine("WWWWEEEEEEEW");
            }
            if (e.KeyChar == (char)Keys.Return)
            {
                e.Handled = true;
               //     Debug.WriteLine("returndsdas presed");
            }
        }