diff --git a/Source/Demos/Pong/Content/Content.mgcb b/Source/Demos/Pong/Content/Content.mgcb index 30561ec6..d12ccf8b 100644 --- a/Source/Demos/Pong/Content/Content.mgcb +++ b/Source/Demos/Pong/Content/Content.mgcb @@ -85,3 +85,15 @@ /processorParam:Quality=Best /build:pip.wav +#begin title-screen.png +/importer:TextureImporter +/processor:TextureProcessor +/processorParam:ColorKeyColor=255,0,255,255 +/processorParam:ColorKeyEnabled=True +/processorParam:GenerateMipmaps=False +/processorParam:PremultiplyAlpha=True +/processorParam:ResizeToPowerOfTwo=False +/processorParam:MakeSquare=False +/processorParam:TextureFormat=Color +/build:title-screen.png + diff --git a/Source/Demos/Pong/Content/title-screen.png b/Source/Demos/Pong/Content/title-screen.png new file mode 100644 index 00000000..cdf228a0 Binary files /dev/null and b/Source/Demos/Pong/Content/title-screen.png differ diff --git a/Source/Demos/Pong/Pong.csproj b/Source/Demos/Pong/Pong.csproj index c9fe945e..4ed564ba 100644 --- a/Source/Demos/Pong/Pong.csproj +++ b/Source/Demos/Pong/Pong.csproj @@ -49,7 +49,7 @@ - + @@ -119,6 +119,7 @@ + diff --git a/Source/Demos/Pong/Screens/PongGameScreen.cs b/Source/Demos/Pong/Screens/PongGameScreen.cs index 65d2273b..278ce361 100644 --- a/Source/Demos/Pong/Screens/PongGameScreen.cs +++ b/Source/Demos/Pong/Screens/PongGameScreen.cs @@ -170,7 +170,7 @@ namespace Pong.Screens _ball.Position = new Vector2(ScreenWidth / 2f, ScreenHeight / 2f); _ball.Velocity = new Vector2(_random.Next(2, 5) * -100, 100); _leftScore++; - ScreenManager.LoadScreen(new MagentaScreen(Game), new ExpandTransition(GraphicsDevice, Color.Black, 0.5f)); + ScreenManager.LoadScreen(new TitleScreen(Game), new ExpandTransition(GraphicsDevice, Color.Black, 0.5f)); } if (_ball.Position.X < -halfWidth && _ball.Velocity.X < 0) @@ -178,8 +178,7 @@ namespace Pong.Screens _ball.Position = new Vector2(ScreenWidth / 2f, ScreenHeight / 2f); _ball.Velocity = new Vector2(_random.Next(2, 5) * 100, 100); _rightScore++; - ScreenManager.LoadScreen(new MagentaScreen(Game), new ExpandTransition(GraphicsDevice, Color.Black, 0.5f)); - + ScreenManager.LoadScreen(new TitleScreen(Game), new ExpandTransition(GraphicsDevice, Color.Black, 0.5f)); } } diff --git a/Source/Demos/Pong/Screens/MagentaScreen.cs b/Source/Demos/Pong/Screens/TitleScreen.cs similarity index 67% rename from Source/Demos/Pong/Screens/MagentaScreen.cs rename to Source/Demos/Pong/Screens/TitleScreen.cs index 33da6547..242f6904 100644 --- a/Source/Demos/Pong/Screens/MagentaScreen.cs +++ b/Source/Demos/Pong/Screens/TitleScreen.cs @@ -7,11 +7,12 @@ using MonoGame.Extended.Screens.Transitions; namespace Pong.Screens { - public class MagentaScreen : GameScreen + public class TitleScreen : GameScreen { private SpriteBatch _spriteBatch; + private Texture2D _background; - public MagentaScreen(Game game) + public TitleScreen(Game game) : base(game) { game.IsMouseVisible = true; @@ -21,6 +22,7 @@ namespace Pong.Screens { base.LoadContent(); _spriteBatch = new SpriteBatch(GraphicsDevice); + _background = Content.Load("title-screen"); } public override void Update(GameTime gameTime) @@ -28,15 +30,15 @@ namespace Pong.Screens var mouseState = Mouse.GetState(); if (mouseState.LeftButton == ButtonState.Pressed) - ScreenManager.LoadScreen(new PongGameScreen(Game), new ExpandTransition(GraphicsDevice, Color.Black, 0.5f)); + ScreenManager.LoadScreen(new PongGameScreen(Game), new FadeTransition(GraphicsDevice, Color.Black, 0.5f)); } public override void Draw(GameTime gameTime) { GraphicsDevice.Clear(Color.Magenta); - _spriteBatch.Begin(); - _spriteBatch.FillRectangle(new RectangleF(100, 200, 300, 400), Color.AliceBlue); + _spriteBatch.Begin(samplerState: SamplerState.PointClamp); + _spriteBatch.Draw(_background, new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height), Color.White); _spriteBatch.End(); } }