Exemple #1
0
 protected override void OnLoad(EventArgs e)
 {
     // called upon app init
     ClientSize    = new Size(640, 400);
     game          = new Game(this);
     game.screen   = new Surface(Width, Height);
     Sprite.target = game.screen;
     screenID      = game.screen.GenTexture();
     game.Init();
 }
		protected override void OnLoad( EventArgs e )
		{
			// called upon app init
			GL.Hint( HintTarget.PerspectiveCorrectionHint, HintMode.Nicest );
			ClientSize = new Size( 640, 400 );
			game = new Game();
			game.screen = new Surface( Width, Height );
			Sprite.target = game.screen;
			screenID = game.screen.GenTexture();
			game.Init();
		}
 protected override void OnLoad(EventArgs e)
 {
     // called upon app init
     GL.ClearColor(Color.Black);
     GL.Enable(EnableCap.Texture2D);
     GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest);
     Width         = 600;
     Height        = 600;
     game          = new Game();
     game.screen   = new Surface(Width, Height);
     Sprite.target = game.screen;
     screenID      = game.screen.GenTexture();
     game.Init();
 }
Exemple #4
0
		protected override void OnLoad( EventArgs e )
		{
			// called upon app init
			GL.ClearColor( Color.Black );
			GL.Enable( EnableCap.Texture2D );
			GL.Hint( HintTarget.PerspectiveCorrectionHint, HintMode.Nicest );
			Width = 800;
			Height = 480;
			game = new Game();
			game.screen = new Surface( Width, Height );
			Sprite.target = game.screen;
			screenID = game.screen.GenTexture();
			game.Init( runningTime, useGPU, gpuPlatform );
		}
Exemple #5
0
 protected override void OnLoad(EventArgs e)
 {
     // called upon app init
     ////////////////verandering part 2
     //GL.ClearColor( Color.Black );
     //GL.Enable( EnableCap.Texture2D );
     //GL.Disable( EnableCap.DepthTest );
     GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest);
     ClientSize    = new Size(640, 400);
     game          = new Game();
     game.screen   = new Surface(Width, Height);
     Sprite.target = game.screen;
     screenID      = game.screen.GenTexture();
     //test voor map deel 2
     //game.map = new Surface(Width, Height);
     //Sprite.target = game.map;
     //mapID = game.map.GenTexture();
     game.Init();
 }
        protected override void OnLoad(EventArgs e)
        {
            // called upon app init
            GL.ClearColor(System.Drawing.Color.Black);
            GL.Enable(EnableCap.Texture2D);
            GL.Disable(EnableCap.DepthTest);
            GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest);
            ClientSize = new Size(1024, 512);
            game = new Game();
            game.screen = new Surface(Width, Height);
            Sprite.target = game.screen;
            screenID = game.screen.GenTexture();

            //Event listener for the mouse.
            System.Windows.Forms.Cursor.Position = new Point(Bounds.Left + Bounds.Width / 2, Bounds.Top + Bounds.Height / 2);

            MouseMove += new EventHandler<MouseMoveEventArgs>(OnMouseMove);

            game.Init(Bounds);
        }
Exemple #7
0
        protected override void OnLoad(EventArgs e)
        {
            VSync = VSyncMode.On;

            CreateShaders();
            // Other state
            GL.Enable(EnableCap.DepthTest);
            GL.ClearColor(System.Drawing.Color.Black);

            ResetCamera();
            // called upon app init
            GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest);
            ClientSize    = new Size(1024, 1024);
            Location      = new Point(300, 0);
            game          = new Game();
            game.screen   = new Surface(Width, Height);
            Sprite.target = game.screen;
            screenID      = game.screen.GenTexture();
            game.Init();
            Game.printInstructions();
        }
Exemple #8
0
        /// <summary>
        /// Handles the input from the keyboard
        /// </summary>
        /// <param name="keyboard"></param>
        private void HandleInput(KeyboardState keyboard)
        {
            float rotationSpeed    = 0.03f;
            float translationSpeed = 0.03f;

            if (keyboard[OpenTK.Input.Key.Escape])
            {
                this.Exit();
            }

            if (keyboard[OpenTK.Input.Key.Left])
            {
                Matrix4 rot = Matrix4.CreateRotationY(-rotationSpeed);
                angle           -= rotationSpeed;
                projectionMatrix = rot * projectionMatrix;
            }
            if (keyboard[OpenTK.Input.Key.Right])
            {
                Matrix4 rot = Matrix4.CreateRotationY(+rotationSpeed);
                angle           += rotationSpeed;
                projectionMatrix = rot * projectionMatrix;
            }
            if (keyboard[OpenTK.Input.Key.Up])
            {
                Matrix4 rot = Matrix4.CreateRotationX(-rotationSpeed);
                angle           -= rotationSpeed;
                projectionMatrix = rot * projectionMatrix;
            }
            if (keyboard[OpenTK.Input.Key.Down])
            {
                Matrix4 rot = Matrix4.CreateRotationX(+rotationSpeed);
                angle           += rotationSpeed;
                projectionMatrix = rot * projectionMatrix;
            }


            if (keyboard[OpenTK.Input.Key.R])
            {
                ResetCamera();
            }
            //if (keyboard[OpenTK.Input.Key.Number1])
            //{
            //    Game.RestartScene(true);
            //}
            //if (keyboard[OpenTK.Input.Key.Number2])
            //{
            //    Game.RestartScene(false);
            //}

            if (keyboard[OpenTK.Input.Key.W])
            {
                Matrix4 trans = Matrix4.CreateTranslation(-translationSpeed * (float)Math.Sin(angle), 0, translationSpeed * (float)Math.Cos(angle));
                modelviewMatrix = trans * modelviewMatrix;
            }

            if (keyboard[OpenTK.Input.Key.S])
            {
                Matrix4 trans = Matrix4.CreateTranslation(translationSpeed * (float)Math.Sin(angle), 0, -translationSpeed * (float)Math.Cos(angle));
                modelviewMatrix = trans * modelviewMatrix;
            }

            if (keyboard[OpenTK.Input.Key.A])
            {
                Matrix4 trans = Matrix4.CreateTranslation(translationSpeed * (float)Math.Cos(angle), 0, translationSpeed * (float)Math.Sin(angle));
                modelviewMatrix = trans * modelviewMatrix;
            }
            if (keyboard[OpenTK.Input.Key.D])
            {
                Matrix4 trans = Matrix4.CreateTranslation(-translationSpeed * (float)Math.Cos(angle), 0, -translationSpeed * (float)Math.Sin(angle));
                modelviewMatrix = trans * modelviewMatrix;
            }

            if (keyboard[OpenTK.Input.Key.Q])
            {
                Matrix4 trans = Matrix4.CreateTranslation(0, translationSpeed, 0);
                modelviewMatrix = trans * modelviewMatrix;
            }

            if (keyboard[OpenTK.Input.Key.E])
            {
                Matrix4 trans = Matrix4.CreateTranslation(0, -translationSpeed, 0);
                modelviewMatrix = trans * modelviewMatrix;
                position.Y     += translationSpeed;
            }

            if (keyboard[OpenTK.Input.Key.Space])
            {
                if (SpaceHasBeenReleased)
                {
                    SpaceHasBeenReleased = false;
                    if (game.running)
                    {
                        game.running = false;
                    }
                    else
                    {
                        game.running = true;
                    }
                }
            }
            else
            {
                SpaceHasBeenReleased = true;
            }

            //if (keyboard[OpenTK.Input.Key.Number1])
            //{
            //    game.sceneNumber = 0;
            //    game.Init();
            //}

            if (keyboard[OpenTK.Input.Key.Number1])
            {
                game.sceneNumber = 1;
                game.Init();
            }
            if (keyboard[OpenTK.Input.Key.Number2])
            {
                game.sceneNumber = 2;
                game.Init();
            }
            if (keyboard[OpenTK.Input.Key.Number3])
            {
                game.sceneNumber = 3;
                game.Init();
            }
            if (keyboard[OpenTK.Input.Key.Number4])
            {
                game.sceneNumber = 4;
                game.Init();
            }
            if (keyboard[OpenTK.Input.Key.P] && (game.sceneNumber == 2 || game.sceneNumber == 4))
            {
                Game.cubes[0] = new Cube();
            }

            if (keyboard[OpenTK.Input.Key.Number9])
            {
                Game.displayMode = Game.Mode.PARTICLES;
            }
            if (keyboard[OpenTK.Input.Key.Number8])
            {
                Game.displayMode = Game.Mode.SHAPES;
            }

            //if (keyboard[OpenTK.Input.Key.I])
            //{
            //    VideoMaker.Start();
            //}
            //
            //if (keyboard[OpenTK.Input.Key.O])
            //{
            //    VideoMaker.Close();
            //}
        }