Skip to content

Commit b77db23

Browse files
martinlindheveeableful
authored andcommitted
README: update the example to work out-of-box on macOS (#319)
1 parent c737384 commit b77db23

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

README.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,23 @@ func main() {
4040
if err != nil {
4141
panic(err)
4242
}
43+
surface.FillRect(nil, 0)
4344

4445
rect := sdl.Rect{0, 0, 200, 200}
4546
surface.FillRect(&rect, 0xffff0000)
4647
window.UpdateSurface()
4748

48-
sdl.Delay(2500)
49+
running := true
50+
for running {
51+
for event := sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
52+
switch event.(type) {
53+
case *sdl.QuitEvent:
54+
println("Quit")
55+
running = false
56+
break
57+
}
58+
}
59+
}
4960
}
5061
```
5162

0 commit comments

Comments
 (0)