2020-11-20 22:42:05 +00:00
|
|
|
using Microsoft.Xna.Framework;
|
|
|
|
using System;
|
|
|
|
|
|
|
|
namespace SemiColinGames {
|
|
|
|
|
2020-11-20 22:52:40 +00:00
|
|
|
public class DesktopGLDisplay : IDisplay {
|
2020-11-20 22:42:05 +00:00
|
|
|
private GameWindow window;
|
|
|
|
private GraphicsDeviceManager graphics;
|
|
|
|
|
|
|
|
public void Initialize(GameWindow window, GraphicsDeviceManager graphics) {
|
|
|
|
this.window = window;
|
|
|
|
this.graphics = graphics;
|
|
|
|
window.Title = "Sneak";
|
|
|
|
}
|
|
|
|
|
|
|
|
public void SetFullScreen(bool fullScreen) {
|
|
|
|
if (fullScreen) {
|
2020-11-20 22:52:40 +00:00
|
|
|
// In DesktopGL, we misappropriate "fullscreen" to be "the settings good for recording
|
2020-11-20 22:42:05 +00:00
|
|
|
// gameplay GIFs".
|
|
|
|
window.IsBorderless = true;
|
|
|
|
// graphics.PreferredBackBufferWidth = 720;
|
|
|
|
// graphics.PreferredBackBufferHeight = 405;
|
|
|
|
graphics.PreferredBackBufferWidth = graphics.GraphicsDevice.DisplayMode.Width;
|
|
|
|
graphics.PreferredBackBufferHeight = graphics.GraphicsDevice.DisplayMode.Height;
|
|
|
|
} else {
|
|
|
|
window.IsBorderless = false;
|
2021-02-08 22:26:04 +00:00
|
|
|
graphics.PreferredBackBufferWidth = 1280;
|
|
|
|
graphics.PreferredBackBufferHeight = 720;
|
2020-11-20 22:42:05 +00:00
|
|
|
}
|
|
|
|
Debug.WriteLine("display: {0}x{1}, fullscreen={2}",
|
|
|
|
graphics.PreferredBackBufferWidth,
|
|
|
|
graphics.PreferredBackBufferHeight,
|
|
|
|
fullScreen);
|
|
|
|
graphics.ApplyChanges();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-20 22:52:40 +00:00
|
|
|
public static class DesktopGLProgram {
|
2020-11-20 22:42:05 +00:00
|
|
|
[STAThread]
|
|
|
|
static void Main() {
|
|
|
|
using (var game = new SneakGame()) {
|
2020-11-20 22:52:40 +00:00
|
|
|
game.Services.AddService(typeof(IDisplay), new DesktopGLDisplay());
|
2020-11-20 22:42:05 +00:00
|
|
|
game.Run();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|