diff --git a/Jumpy.Shared/IWindow.cs b/Jumpy.Shared/IWindow.cs new file mode 100644 index 0000000..4a9211d --- /dev/null +++ b/Jumpy.Shared/IWindow.cs @@ -0,0 +1,7 @@ +using Microsoft.Xna.Framework; + +namespace Jumpy { + public interface IWindow { + void SetFullScreen(bool fullScreen, Game game, GraphicsDeviceManager graphics); + } +} diff --git a/Jumpy.Shared/Jumpy.Shared.projitems b/Jumpy.Shared/Jumpy.Shared.projitems index 88dcb13..64df16b 100644 --- a/Jumpy.Shared/Jumpy.Shared.projitems +++ b/Jumpy.Shared/Jumpy.Shared.projitems @@ -9,6 +9,7 @@ Jumpy.Shared + diff --git a/Jumpy.Shared/JumpyGame.cs b/Jumpy.Shared/JumpyGame.cs index 36901c1..65e5d20 100644 --- a/Jumpy.Shared/JumpyGame.cs +++ b/Jumpy.Shared/JumpyGame.cs @@ -10,6 +10,8 @@ namespace Jumpy { SpriteBatch spriteBatch; SpriteFont font; KeyboardInput keyboardInput = new KeyboardInput(); + bool fullScreen = false; + IWindow window; public JumpyGame() { graphics = new GraphicsDeviceManager(this); @@ -18,6 +20,8 @@ namespace Jumpy { // Performs initialization that's needed before starting to run. protected override void Initialize() { + window = (IWindow) Services.GetService(typeof(IWindow)); + window.SetFullScreen(fullScreen, this, graphics); base.Initialize(); } @@ -37,10 +41,10 @@ namespace Jumpy { keyboardInput.Update(); List keysDown = keyboardInput.NewKeysDown(); - //if (keysDown.Contains(Keys.F12)) - //{ - // SetFullScreen(!fullScreen); - //} + if (keysDown.Contains(Keys.F12)) { + window.SetFullScreen(!fullScreen, this, graphics); + fullScreen = !fullScreen; + } if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || keysDown.Contains(Keys.Escape)) {