public MenuCredits(ContentManager contentMngr) { mainMenuBG = contentMngr.Load <Texture2D>(@"Textures\Menu\dunebuggy"); menuHeader = contentMngr.Load <Texture2D>(@"Textures\Menu\MenuHeader"); BoldFont = contentMngr.Load <SpriteFont>("Bold Courier New"); RegularFont = contentMngr.Load <SpriteFont>("Courier New"); _PreviousInputState = GameInput.GetState(); }
public MenuOptions(ContentManager contentMngr) { mainMenuBG = contentMngr.Load <Texture2D>(@"Textures\Menu\dunebuggy"); menuHeader = contentMngr.Load <Texture2D>(@"Textures\Menu\MenuHeader"); optionsSoundsOff = contentMngr.Load <Texture2D>(@"Textures\Menu\SoundsOff"); optionsSoundsOn = contentMngr.Load <Texture2D>(@"Textures\Menu\SoundsOn"); _PreviousInputState = GameInput.GetState(); }
public GameMode Update(Game1 game) { GameInput currentInputState = GameInput.GetState(); // This should cause the selected menu item to "scroll" up or down // depending on what D-Pad button is pressed. if (currentInputState.DownButton == ButtonState.Pressed && _PreviousInputState.DownButton == ButtonState.Released) { Sound.Play(Sound.Sounds.MenuMove); if (_SelectedMenuItem == _TotalMenuItems) { _SelectedMenuItem = 0; } else { _SelectedMenuItem++; } } else if (currentInputState.UpButton == ButtonState.Pressed && _PreviousInputState.UpButton == ButtonState.Released) { Sound.Play(Sound.Sounds.MenuMove); if (_SelectedMenuItem == 0) { _SelectedMenuItem = _TotalMenuItems; } else { _SelectedMenuItem--; } } if (currentInputState.SelectButton == ButtonState.Pressed && _PreviousInputState.SelectButton == ButtonState.Released) { Sound.Play(Sound.Sounds.MenuSelect); switch (_SelectedMenuItem) { case 0: //Play return(GameMode.Play); case 1: //Options return(GameMode.Options); case 2: //Credits return(GameMode.Credits); case 3: //Exit game.Exit(); break; } } // Set the previous state to the current input state at // the end so that the next time this method is called, // the state can be compared _PreviousInputState = currentInputState; return(GameMode.Menu); }//Update()
public GameMode UpdateCredits(Game1 game) { GameInput currentInputState = GameInput.GetState(); if (currentInputState.ExitButton == ButtonState.Pressed && _PreviousInputState.ExitButton == ButtonState.Released) { return(GameMode.Menu); } return(GameMode.Credits); }
public GameMode UpdateOptions(Game1 game) { GameInput currentInputState = GameInput.GetState(); if (currentInputState.DownButton == ButtonState.Pressed && _PreviousInputState.DownButton == ButtonState.Released) { Sound.Play(Sound.Sounds.MenuMove); if (_SelectedOptionItem == _TotalOptionItems) { _SelectedOptionItem = 0; } else { _SelectedOptionItem++; } } else if (currentInputState.UpButton == ButtonState.Pressed && _PreviousInputState.UpButton == ButtonState.Released) { Sound.Play(Sound.Sounds.MenuMove); if (_SelectedOptionItem == 0) { _SelectedOptionItem = _TotalOptionItems; } else { _SelectedOptionItem--; } } if (currentInputState.SelectButton == ButtonState.Pressed && _PreviousInputState.SelectButton == ButtonState.Released) { Sound.Play(Sound.Sounds.MenuSelect); switch (_SelectedOptionItem) { case 0: //Off Sound.StartMusic(); break; case 1: //On Sound.StopMusic(); break; } } else if (currentInputState.ExitButton == ButtonState.Pressed && _PreviousInputState.ExitButton == ButtonState.Released) { return(GameMode.Menu); } // Set the previous state to the current input state at // the end so that the next time this method is called, // the state can be compared _PreviousInputState = currentInputState; return(GameMode.Options); }
public Menu(ContentManager contentMngr) { mainMenuBG = contentMngr.Load <Texture2D>(@"Textures\Menu\dunebuggy"); menuCredits = contentMngr.Load <Texture2D>(@"Textures\Menu\MenuCredits"); menuExit = contentMngr.Load <Texture2D>(@"Textures\Menu\MenuExit"); menuOptions = contentMngr.Load <Texture2D>(@"Textures\Menu\MenuOptions"); menuPlay = contentMngr.Load <Texture2D>(@"Textures\Menu\MenuPlay"); menuHeader = contentMngr.Load <Texture2D>(@"Textures\Menu\MenuHeader"); //optionsSoundsOff = contentMngr.Load<Texture2D>(@"Textures\Menu\SoundsOff"); //optionsSoundsOn = contentMngr.Load<Texture2D>(@"Textures\Menu\SoundsOn"); _PreviousInputState = GameInput.GetState(); }//Menu
public void GetInputStates() { // Remember last keyboard and gamepad states for the menu remUpPressed = _GamePadState.DPad.Up == ButtonState.Pressed || _GamePadState.ThumbSticks.Left.Y > 0.5f || _KeyboardState.IsKeyDown(Keys.Up); remDownPressed = _GamePadState.DPad.Down == ButtonState.Pressed || _GamePadState.ThumbSticks.Left.Y < -0.5f || _KeyboardState.IsKeyDown(Keys.Down); // Get current gamepad and keyboard states GameInput.GetState(); }//GetInputStates()
public GameMode Update(Game1 game) { GameInput currentInputState = GameInput.GetState(); if (currentInputState.Test == ButtonState.Pressed) { TEST = true; } if (currentInputState.RightButton == ButtonState.Pressed) { modelRotation += 0.05f; } hud.Update(game); _PreviousInputState = currentInputState; return(GameMode.Play); }
/// <summary> /// Updates the HUD /// </summary> /// <param name="game">Game Object that this game is using</param> public void Update(Game1 game) { GameInput currentInputState = GameInput.GetState(); if (currentInputState.UpButton == ButtonState.Pressed) { if (speed <= 150) { speed += 1f; } else if (speed > 150) { speed += .5f; } } else { speed -= 1; } speed = (int)(MathHelper.Clamp((speed), 0f, 200)); rotation = MathHelper.ToRadians(680) / 500 * speed - MathHelper.ToRadians(135); }
/// <summary> /// Default Constructor /// </summary> /// <param name="contentMngr">Content Manager that this game is using</param> public HUD(ContentManager contentMngr) { gaugePosition = new Vector2(720, 520); speed = 0; throttle = 1f; afterburner = 1f; //I made a SpriteFont from a texture using. You could easily replace this with an XML-defined SpriteFont. SpriteFont = contentMngr.Load <SpriteFont>(@"Textures\HUD\dungeon28"); //Load the Sprites. GaugeSprite = contentMngr.Load <Texture2D>(@"Textures\HUD\gauge"); NeedleSprite = contentMngr.Load <Texture2D>(@"Textures\HUD\needle"); MeterFillSprite = contentMngr.Load <Texture2D>(@"Textures\HUD\meterfill"); lapTimes = contentMngr.Load <Texture2D>(@"Textures\HUD\laptimes"); position = contentMngr.Load <Texture2D>(@"Textures\HUD\position"); //Load the Effect used to render the Meters on top and bottom. FillEffect = contentMngr.Load <Effect>(@"Textures\HUD\MeterEffect"); _PreviousInputState = GameInput.GetState(); }
public Play(ContentManager contentMngr) { myModel = contentMngr.Load <Model>(@"Models\Mars"); _PreviousInputState = GameInput.GetState(); hud = new HUD(contentMngr); }