Replaced Delay with proper Event Loop
This commit is contained in:
parent
a2eece5ed6
commit
93b70abd8e
@ -8,6 +8,8 @@ CONSTANT INT SCREEN_HEIGHT = 480;
|
|||||||
MAIN
|
MAIN
|
||||||
DIM AS PWINDOW window = NULL;
|
DIM AS PWINDOW window = NULL;
|
||||||
DIM AS PSURFACE screenSurface = NULL;
|
DIM AS PSURFACE screenSurface = NULL;
|
||||||
|
DIM AS BOOL quit = false;
|
||||||
|
DIM AS SDL_Event e;
|
||||||
|
|
||||||
IF ( SDL_Init( SDL_INIT_VIDEO ) < 0 ) THEN
|
IF ( SDL_Init( SDL_INIT_VIDEO ) < 0 ) THEN
|
||||||
PRINT( SDL_GetError() );
|
PRINT( SDL_GetError() );
|
||||||
@ -25,12 +27,22 @@ MAIN
|
|||||||
ELSE
|
ELSE
|
||||||
// Get Window Surface
|
// Get Window Surface
|
||||||
screenSurface = SDL_GetWindowSurface( window );
|
screenSurface = SDL_GetWindowSurface( window );
|
||||||
// Fill the surface with White
|
|
||||||
SDL_FillRect( screenSurface, NULL, SDL_MapRGB( screenSurface->format, 255, 255, 255 ) );
|
|
||||||
// Update the Surface
|
WHILE (NOT quit) BEGIN
|
||||||
SDL_UpdateWindowSurface( window );
|
WHILE ( SDL_PollEvent( ADDR e) != 0 ) BEGIN
|
||||||
// Wait 5 seconds
|
SELECT (e.type) BEGIN
|
||||||
SDL_Delay( 5000 );
|
CASE SDL_QUIT:
|
||||||
|
quit = true;
|
||||||
|
ENDCASE
|
||||||
|
ENDSELECT
|
||||||
|
WEND
|
||||||
|
// Fill the surface with White
|
||||||
|
SDL_FillRect( screenSurface, NULL, SDL_MapRGB( screenSurface->format, 255, 255, 255 ) );
|
||||||
|
// Update the Surface
|
||||||
|
SDL_UpdateWindowSurface( window );
|
||||||
|
|
||||||
|
WEND
|
||||||
ENDIF
|
ENDIF
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user