Make IWindow interface & make fullscreen work in UWP & OpenGL.
GitOrigin-RevId: 17e3e115481779249f59d68acab6325a78592eaf
This commit is contained in:
parent
149ecf8075
commit
a33c4d90fd
7
Jumpy.Shared/IWindow.cs
Normal file
7
Jumpy.Shared/IWindow.cs
Normal file
@ -0,0 +1,7 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
|
||||
namespace Jumpy {
|
||||
public interface IWindow {
|
||||
void SetFullScreen(bool fullScreen, Game game, GraphicsDeviceManager graphics);
|
||||
}
|
||||
}
|
@ -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>
|
||||
|
@ -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…
Reference in New Issue
Block a user