Browse Source

Make IWindow interface & make fullscreen work in UWP & OpenGL.

GitOrigin-RevId: 17e3e11548
master
Colin McMillen 4 years ago
parent
commit
a33c4d90fd
  1. 7
      Jumpy.Shared/IWindow.cs
  2. 1
      Jumpy.Shared/Jumpy.Shared.projitems
  3. 12
      Jumpy.Shared/JumpyGame.cs

7
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);
}
}

1
Jumpy.Shared/Jumpy.Shared.projitems

@ -9,6 +9,7 @@
<Import_RootNamespace>Jumpy.Shared</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)IWindow.cs" />
<Compile Include="$(MSBuildThisFileDirectory)KeyboardInput.cs" />
<Compile Include="$(MSBuildThisFileDirectory)JumpyGame.cs" />
</ItemGroup>

12
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<Keys> 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)) {

Loading…
Cancel
Save