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>
|
<Import_RootNamespace>Jumpy.Shared</Import_RootNamespace>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)IWindow.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)KeyboardInput.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)KeyboardInput.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)JumpyGame.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)JumpyGame.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -10,6 +10,8 @@ namespace Jumpy {
|
|||||||
SpriteBatch spriteBatch;
|
SpriteBatch spriteBatch;
|
||||||
SpriteFont font;
|
SpriteFont font;
|
||||||
KeyboardInput keyboardInput = new KeyboardInput();
|
KeyboardInput keyboardInput = new KeyboardInput();
|
||||||
|
bool fullScreen = false;
|
||||||
|
IWindow window;
|
||||||
|
|
||||||
public JumpyGame() {
|
public JumpyGame() {
|
||||||
graphics = new GraphicsDeviceManager(this);
|
graphics = new GraphicsDeviceManager(this);
|
||||||
@ -18,6 +20,8 @@ namespace Jumpy {
|
|||||||
|
|
||||||
// Performs initialization that's needed before starting to run.
|
// Performs initialization that's needed before starting to run.
|
||||||
protected override void Initialize() {
|
protected override void Initialize() {
|
||||||
|
window = (IWindow) Services.GetService(typeof(IWindow));
|
||||||
|
window.SetFullScreen(fullScreen, this, graphics);
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,10 +41,10 @@ namespace Jumpy {
|
|||||||
keyboardInput.Update();
|
keyboardInput.Update();
|
||||||
List<Keys> keysDown = keyboardInput.NewKeysDown();
|
List<Keys> keysDown = keyboardInput.NewKeysDown();
|
||||||
|
|
||||||
//if (keysDown.Contains(Keys.F12))
|
if (keysDown.Contains(Keys.F12)) {
|
||||||
//{
|
window.SetFullScreen(!fullScreen, this, graphics);
|
||||||
// SetFullScreen(!fullScreen);
|
fullScreen = !fullScreen;
|
||||||
//}
|
}
|
||||||
|
|
||||||
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
|
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed ||
|
||||||
keysDown.Contains(Keys.Escape)) {
|
keysDown.Contains(Keys.Escape)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user