Make escape key quit application
This commit is contained in:
parent
c3d17459c6
commit
3cb7e3a5c9
@ -51,10 +51,15 @@ func (c *Controller) Run() {
|
||||
running := true
|
||||
for running {
|
||||
for event := sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
|
||||
switch event.(type) {
|
||||
switch e := event.(type) {
|
||||
case *sdl.QuitEvent:
|
||||
println("Quit")
|
||||
running = false
|
||||
case *sdl.KeyboardEvent:
|
||||
if e.Type == sdl.KEYDOWN {
|
||||
if e.Keysym.Sym == sdl.K_ESCAPE {
|
||||
running = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user