/// <summary> /// This is called when the game should draw itself. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Draw(GameTime gameTime) { //TODO: Add your drawing code here GamePadEx.Update(gameTime); TouchPanelEx.Update(gameTime); ScreenUtil.Draw(gameTime, spriteBatch); }
/// <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) { // TODO: Add your update logic here base.Update(gameTime); GamePadEx.Update(gameTime); TouchPanelEx.Update(gameTime); ScreenUtil.Update(gameTime); }
public static void Update(GameTime gameTime) { GamePadEx.Update(gameTime); KeyboardEx.Update(gameTime); TouchPanelEx.Update(gameTime); if (CurrentScreen != null) { CurrentScreen.Update(gameTime); } }
public override void Update(GameTime gameTime) { base.Update(gameTime); var nextScreen = GamePadEx.WasJustPressed(PlayerIndex.One, Buttons.A) || GamePadEx.WasJustPressed(PlayerIndex.One, Buttons.Start) || TouchPanelEx.WasJustPressed(); if (nextScreen) { ScreenUtil.Show(new TitleScreen(Parent)); } }
public override void Update(GameTime gameTime) { base.Update(gameTime); var gamepad1 = GamePadEx.GetState(PlayerIndex.One); if (gamepad1.Buttons.Back == ButtonState.Pressed) { ScreenUtil.Show(new TitleScreen(Parent)); } // === TouchPanel or Mouse === var touchState = TouchPanelEx.GetState(); if (touchState.Count > 0) { emitter.Active = touchState [0].State == TouchLocationState.Pressed || touchState [0].State == TouchLocationState.Moved; emitter.EmitterRect = new Rectangle( (int)Math.Round(touchState [0].Position.X), (int)Math.Round(touchState [0].Position.Y), emitter.EmitterRect.Width, emitter.EmitterRect.Height ); } else { emitter.Active = false; } // === // === Controller or Keyboard === if (gamepad1.IsButtonDown(Buttons.A)) { emitter.Active = true; } if (gamepad1.DPad.Up == ButtonState.Pressed) { emitter.EmitterRect = new Rectangle( emitter.EmitterRect.X, emitter.EmitterRect.Y - 5, emitter.EmitterRect.Width, emitter.EmitterRect.Height); } else if (gamepad1.DPad.Down == ButtonState.Pressed) { emitter.EmitterRect = new Rectangle( emitter.EmitterRect.X, emitter.EmitterRect.Y + 5, emitter.EmitterRect.Width, emitter.EmitterRect.Height); } if (gamepad1.DPad.Left == ButtonState.Pressed) { emitter.EmitterRect = new Rectangle( emitter.EmitterRect.X - 5, emitter.EmitterRect.Y, emitter.EmitterRect.Width, emitter.EmitterRect.Height); } else if (gamepad1.DPad.Right == ButtonState.Pressed) { emitter.EmitterRect = new Rectangle( emitter.EmitterRect.X + 5, emitter.EmitterRect.Y, emitter.EmitterRect.Width, emitter.EmitterRect.Height); } // === emitter.Update(gameTime.ElapsedGameTime.TotalSeconds); }