private static void Main() { Console.WriteLine(); WindowingService.Logger.OutputWriter = Console.Out; WindowingService.Logger.OutputLevel = Logger.Level.Debug; using var service = WindowingService.Create(); var wci = new WindowCreateInfo(100, 100, 400, 400, "Hello, OpenWindow! 💩", decorated: true, resizable: false); using var window = service.CreateWindow(wci); var iconWidth = 64; var iconHeight = 64; Span <Color> iconPixelData = stackalloc Color[iconWidth * iconHeight]; FillIconPixelData(iconWidth, iconHeight, iconPixelData); window.SetIcon <Color>(iconPixelData, iconWidth, iconHeight); var cursorWidth = 32; var cursorHeight = 32; Span <Color> cursorPixelData = stackalloc Color[cursorWidth * cursorHeight]; FillIconPixelData(cursorWidth, cursorHeight, cursorPixelData); window.SetCursor <Color>(cursorPixelData, cursorWidth, cursorHeight, 15, 15); window.MinSize = new Size(MinWidth, MinHeight); window.MaxSize = new Size(MaxWidth, MaxHeight); window.CloseRequested += (s, e) => Console.WriteLine("Received request to close the window!"); window.Closing += (s, e) => Console.WriteLine("Closing the window! Bye :)"); window.FocusChanged += (s, e) => Console.WriteLine(e.HasFocus ? "Got focus!" : "Lost focus!"); window.MouseDown += (s, e) => Console.WriteLine($"Mouse button '{e.Button}' was pressed."); window.MouseUp += (s, e) => Console.WriteLine($"Mouse button '{e.Button}' was released."); //_window.MouseMove += (s, e) => Console.WriteLine($"Mouse move ({e.X} : {e.Y})."); window.MouseFocusChanged += (s, e) => Console.WriteLine(e.HasFocus ? $"Got mouse focus." : "Lost mouse focus."); window.KeyDown += (s, e) => { switch (e.Key) { case Key.B: // border window.Decorated = !window.Decorated; break; case Key.R: // resizable window.Resizable = !window.Resizable; break; case Key.M: // move SetRandomBounds(window); break; case Key.P: // print PrintWindowInfo(service, window); break; case Key.J: window.Minimize(); break; case Key.K: window.Restore(); break; case Key.L: window.Maximize(); break; case Key.C: window.CursorVisible = !window.CursorVisible; break; case Key.Escape: window.Close(); break; } }; var scNameMap = KeyUtil.CreateScanCodeNameMap(); scNameMap[ScanCode.Left] = "←"; scNameMap[ScanCode.Right] = "→"; scNameMap[ScanCode.Up] = "↑"; scNameMap[ScanCode.Down] = "↓"; var keyNameMap = KeyUtil.CreateVirtualKeyNameMap(); window.KeyDown += (s, e) => Console.WriteLine($"Key Down: {keyNameMap[e.Key]} ({scNameMap[e.ScanCode]})"); //_window.KeyUp += (s, e) => Console.WriteLine($"Key Up: {keyNameMap[e.Key]} ({scNameMap[e.ScanCode]})"); window.TextInput += (s, e) => Console.WriteLine($"Got text input: {CharacterToPrintable(e.Character)}"); while (!window.IsCloseRequested) { service.WaitEvent(); } }