From 548f2abfeca367f3a3f8fda249c2bee59ae97e36 Mon Sep 17 00:00:00 2001 From: Lilis Iskandar Date: Wed, 12 Jun 2019 22:05:36 +0800 Subject: [PATCH] examples: add sdl.PollEvent() to allow window to show up on macOS Signed-off-by: Lilis Iskandar --- examples/gfx/gfx.c | 2 ++ examples/gfx/gfx.go | 1 + examples/render_queue/render_queue.go | 1 + examples/text/text.go | 1 + examples/texture/texture.go | 1 + examples/texture_png/texture_png.c | 2 ++ examples/texture_png/texture_png.go | 1 + 7 files changed, 9 insertions(+) diff --git a/examples/gfx/gfx.c b/examples/gfx/gfx.c index 8a5d55a..07b510d 100644 --- a/examples/gfx/gfx.c +++ b/examples/gfx/gfx.c @@ -9,6 +9,7 @@ int main() { SDL_Window *window; SDL_Renderer *renderer; + SDL_Event event; Sint16 vx[] = { 100, 300, 200 }; Sint16 vy[] = { 100, 100, 300 }; @@ -27,6 +28,7 @@ int main() filledPolygonColor(renderer, vx, vy, 3, 0xFFFF0000); SDL_RenderPresent(renderer); + SDL_PollEvent(&event); SDL_Delay(3000); SDL_DestroyRenderer(renderer); diff --git a/examples/gfx/gfx.go b/examples/gfx/gfx.go index e0c32a7..32ccfe6 100644 --- a/examples/gfx/gfx.go +++ b/examples/gfx/gfx.go @@ -48,6 +48,7 @@ func run() int { gfx.StringColor(renderer, 16, 16, "GFX Demo", sdl.Color{0, 255, 0, 255}) renderer.Present() + sdl.PollEvent() sdl.Delay(3000) return 0 diff --git a/examples/render_queue/render_queue.go b/examples/render_queue/render_queue.go index 3890971..9245cf2 100644 --- a/examples/render_queue/render_queue.go +++ b/examples/render_queue/render_queue.go @@ -136,6 +136,7 @@ func run() int { }) sdl.Do(func() { + sdl.PollEvent() sdl.Delay(2000) }) diff --git a/examples/text/text.go b/examples/text/text.go index aa57a7d..a69f349 100644 --- a/examples/text/text.go +++ b/examples/text/text.go @@ -55,6 +55,7 @@ func run() int { // Show the pixels for a while window.UpdateSurface() + sdl.PollEvent() sdl.Delay(3000) return 0 diff --git a/examples/texture/texture.go b/examples/texture/texture.go index 738e0c8..31a9895 100644 --- a/examples/texture/texture.go +++ b/examples/texture/texture.go @@ -56,6 +56,7 @@ func run() int { renderer.Copy(texture, &src, &dst) renderer.Present() + sdl.PollEvent() sdl.Delay(2000) return 0 diff --git a/examples/texture_png/texture_png.c b/examples/texture_png/texture_png.c index fe75fb8..1efeb93 100644 --- a/examples/texture_png/texture_png.c +++ b/examples/texture_png/texture_png.c @@ -46,6 +46,8 @@ int main() SDL_RenderCopy(renderer, texture, &src, &dst); SDL_RenderPresent(renderer); + SDL_Event event; + SDL_PollEvent(&event); SDL_Delay(2000); SDL_DestroyTexture(texture); diff --git a/examples/texture_png/texture_png.go b/examples/texture_png/texture_png.go index 1a000d2..694ab27 100644 --- a/examples/texture_png/texture_png.go +++ b/examples/texture_png/texture_png.go @@ -58,6 +58,7 @@ func run() int { renderer.Copy(texture, &src, &dst) renderer.Present() + sdl.PollEvent() sdl.Delay(2000) return 0