Browse Source

Updated .NET Core sample project with keyboard handler.

improved_timing
Ian Burgmyer 7 years ago
parent
commit
d6d4154932
  1. 10
      Samples/Sample.BasicPixelsCore/Window.cs

10
Samples/Sample.BasicPixelsCore/Window.cs

@ -1,9 +1,12 @@
using DotSDL.Graphics;
using DotSDL.Input.Keyboard;
using System;
namespace Sample.BasicPixelsCore {
internal class Window : SdlWindow {
public Window(int width, int height) : base("Basic Pixels (.NET Core)", new Point { X = WindowPosUndefined, Y = WindowPosUndefined }, width, height) { }
public Window(int width, int height) : base("Basic Pixels (.NET Core)", new Point { X = WindowPosUndefined, Y = WindowPosUndefined }, width, height) {
KeyPressed += Window_KeyPressed;
}
private void DrawBackground(ref Color[] pixels) {
byte d = 0;
@ -111,5 +114,10 @@ namespace Sample.BasicPixelsCore {
return color;
}
private void Window_KeyPressed(object sender, DotSDL.Events.KeyboardEvent e) {
if(e.Keycode == Keycode.Escape)
Stop();
}
}
}

Loading…
Cancel
Save