using System;
using System.Drawing;
using Silk.NET.Input;
using Silk.NET.OpenGL;
using Silk.NET.Windowing;
// ReSharper disable AccessToDisposedClosure
namespace SlikTest;
internal static class Program
{
private static void Main(string[] args)
{
using var window = Window.Create(WindowOptions.Default);
IInputContext input;
GL gl = null!;
window.Load += () =>
{
gl = window.CreateOpenGL();
input = window.CreateInput();
input.Keyboards[0].KeyDown += (keyboard, _, _) =>
{
if (keyboard.IsKeyPressed(Key.Enter))
{
switch (window.WindowState)
{
case WindowState.Normal:
window.WindowState = WindowState.Fullscreen;
break;
case WindowState.Fullscreen:
window.WindowState = WindowState.Normal;
break;
default:
throw new ArgumentOutOfRangeException();
}
}
if (keyboard.IsKeyPressed(Key.Escape))
window.Close();
};
};
window.Render += _ =>
{
var color = window.WindowState switch
{
WindowState.Normal => Color.Red,
WindowState.Fullscreen => Color.Green,
_ => Color.White,
};
gl.ClearColor(color);
gl.Clear(ClearBufferMask.ColorBufferBit);
};
window.Run();
}
}
Summary
When trying to set
window.WindowState = WindowState.Normalin fullscreen mode nothing happens with SDL as backend for windowing.Steps to reproduce