diff --git a/BreakoutParty/BreakoutParty.csproj b/BreakoutParty/BreakoutParty.csproj index 81ca207..c19e08e 100644 --- a/BreakoutParty/BreakoutParty.csproj +++ b/BreakoutParty/BreakoutParty.csproj @@ -76,6 +76,7 @@ + @@ -140,6 +141,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest diff --git a/BreakoutParty/BreakoutPartyGame.cs b/BreakoutParty/BreakoutPartyGame.cs index 7e484bb..c6a52dd 100644 --- a/BreakoutParty/BreakoutPartyGame.cs +++ b/BreakoutParty/BreakoutPartyGame.cs @@ -88,7 +88,7 @@ protected override void Initialize() Batch = new SpriteBatch(Graphics.GraphicsDevice); AudioManager = new SoundManager(this); GameManager = new GamestateManager(this); - GameManager.Add(new MainMenuGamestate()); + GameManager.Add(new HowToPlayState()); } /// diff --git a/BreakoutParty/Content/HowToPlay.png b/BreakoutParty/Content/HowToPlay.png new file mode 100644 index 0000000..a51e0c0 Binary files /dev/null and b/BreakoutParty/Content/HowToPlay.png differ diff --git a/BreakoutParty/Gamestates/HowToPlayState.cs b/BreakoutParty/Gamestates/HowToPlayState.cs new file mode 100644 index 0000000..60fe37e --- /dev/null +++ b/BreakoutParty/Gamestates/HowToPlayState.cs @@ -0,0 +1,80 @@ +using BreakoutParty.Sounds; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BreakoutParty.Gamestates +{ + /// + /// "How To Play" information screen. + /// + sealed class HowToPlayState : Gamestate + { + /// + /// for drawing. + /// + private SpriteBatch _Batch; + + /// + /// Texture showing how to play. + /// + private Texture2D _HowToPlayTexture; + + /// + /// Initializes the . + /// + public override void Initialize() + { + _Batch = Manager.Game.Batch; + _HowToPlayTexture = Manager.Game.Content.Load("HowToPlay"); + Manager.Game.AudioManager.Play(MusicTracks.TitleMusic); + } + + /// + /// Destroys the . + /// + public override void Destroy() + { + + } + + /// + /// Updates the . + /// + /// Timing information. + public override void Update(GameTime gameTime) + { + if (InputManager.IsActionPressed(PlayerIndex.One, InputActions.Ok) + || InputManager.IsActionPressed(PlayerIndex.One, InputActions.Abort)) + { + Manager.Game.AudioManager.Play(SoundEffects.MenuValidate); + Manager.Remove(this); + Manager.Add(new MainMenuGamestate()); + } + } + + /// + /// Draws the . + /// + /// Timing information. + /// True, if the next gamestate may draw too. + public override bool Draw(GameTime gameTime) + { + _Batch.Begin(SpriteSortMode.Texture, + BlendState.NonPremultiplied, + SamplerState.PointClamp, + DepthStencilState.None, + RasterizerState.CullNone); + + _Batch.Draw(_HowToPlayTexture, Vector2.Zero, Color.White); + + _Batch.End(); + + return false; + } + } +}