examples: add sdl.PollEvent() to allow window to show up on macOS

Signed-off-by: Lilis Iskandar <lilis@veand.co>
This commit is contained in:
Lilis Iskandar 2019-06-12 22:05:36 +08:00
parent b9da832c23
commit 548f2abfec
7 changed files with 9 additions and 0 deletions

View File

@ -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);

View File

@ -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

View File

@ -136,6 +136,7 @@ func run() int {
})
sdl.Do(func() {
sdl.PollEvent()
sdl.Delay(2000)
})

View File

@ -55,6 +55,7 @@ func run() int {
// Show the pixels for a while
window.UpdateSurface()
sdl.PollEvent()
sdl.Delay(3000)
return 0

View File

@ -56,6 +56,7 @@ func run() int {
renderer.Copy(texture, &src, &dst)
renderer.Present()
sdl.PollEvent()
sdl.Delay(2000)
return 0

View File

@ -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);

View File

@ -58,6 +58,7 @@ func run() int {
renderer.Copy(texture, &src, &dst)
renderer.Present()
sdl.PollEvent()
sdl.Delay(2000)
return 0