examples/render: fix window not showing up in macOS

Signed-off-by: Lilis Iskandar <lilis@veand.co>
This commit is contained in:
Lilis Iskandar 2021-03-07 14:51:04 +08:00
parent cebe7cd7f1
commit 29a79b36df
No known key found for this signature in database
GPG Key ID: 7EE2F0C4E86662C6
1 changed files with 34 additions and 23 deletions

View File

@ -34,6 +34,17 @@ func run() int {
}
defer renderer.Destroy()
running := true
for running {
for event := sdl.PollEvent(); event != nil; event = sdl.PollEvent() {
switch event.(type) {
case *sdl.QuitEvent:
running = false
}
}
renderer.SetDrawColor(0, 0, 0, 255)
renderer.Clear()
renderer.SetDrawColor(255, 255, 255, 255)
@ -63,8 +74,8 @@ func run() int {
renderer.FillRects(rects)
renderer.Present()
sdl.PollEvent()
sdl.Delay(2000)
sdl.Delay(16)
}
return 0
}