sneak/UWP/UwpProgram.cs

43 lines
1.2 KiB
C#
Raw Normal View History

using Microsoft.Xna.Framework;
using Windows.Foundation;
using Windows.UI.ViewManagement;
namespace SemiColinGames {
public class UwpDisplay : IDisplay {
private GraphicsDeviceManager graphics;
public void Initialize(GameWindow window, GraphicsDeviceManager graphics) {
this.graphics = graphics;
SetFullScreen(true);
}
public void SetFullScreen(bool fullScreen) {
graphics.IsFullScreen = fullScreen;
graphics.ApplyChanges();
Debug.WriteLine("display: {0}x{1}, fullscreen={2}",
graphics.PreferredBackBufferWidth,
graphics.PreferredBackBufferHeight,
fullScreen);
}
}
public class UwpSneakGame : SneakGame {
public UwpSneakGame() {
Services.AddService(typeof(IDisplay), new UwpDisplay());
}
}
public static class UwpProgram {
static void Main() {
ApplicationView.PreferredLaunchViewSize = new Size(1920, 1080);
// Could also choose FullScreen here, if we wanted.
ApplicationView.PreferredLaunchWindowingMode =
ApplicationViewWindowingMode.PreferredLaunchViewSize;
var factory = new MonoGame.Framework.GameFrameworkViewSource<UwpSneakGame>();
Windows.ApplicationModel.Core.CoreApplication.Run(factory);
}
}
}