protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } base.Update(gameTime); flock.Update(); }
protected override void OnUpdateFrame(FrameEventArgs e) { base.OnUpdateFrame(e); // Update boids var ModelMatrices = flock.Update((float)e.Time); GL.BufferSubData(BufferTarget.ArrayBuffer, (IntPtr)0, flock.Boids.Count * (Vector4.SizeInBytes * 4), ModelMatrices.ToArray()); if (Keyboard.GetState().IsKeyDown(Key.Escape)) { Exit(); } }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { this.Exit(); } mousePressed(); flock.Update(gameTime); // TODO: Add your update logic here base.Update(gameTime); }