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:
parent
b9da832c23
commit
548f2abfec
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -136,6 +136,7 @@ func run() int {
|
|||
})
|
||||
|
||||
sdl.Do(func() {
|
||||
sdl.PollEvent()
|
||||
sdl.Delay(2000)
|
||||
})
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ func run() int {
|
|||
|
||||
// Show the pixels for a while
|
||||
window.UpdateSurface()
|
||||
sdl.PollEvent()
|
||||
sdl.Delay(3000)
|
||||
|
||||
return 0
|
||||
|
|
|
@ -56,6 +56,7 @@ func run() int {
|
|||
renderer.Copy(texture, &src, &dst)
|
||||
renderer.Present()
|
||||
|
||||
sdl.PollEvent()
|
||||
sdl.Delay(2000)
|
||||
|
||||
return 0
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -58,6 +58,7 @@ func run() int {
|
|||
renderer.Copy(texture, &src, &dst)
|
||||
renderer.Present()
|
||||
|
||||
sdl.PollEvent()
|
||||
sdl.Delay(2000)
|
||||
|
||||
return 0
|
||||
|
|
Loading…
Reference in New Issue