'' SDL2-Example program:
'' Using SDL2 to create an application windw
'' translated by TJF 2013

#INCLUDE ONCE "SDL2/SDL2.bi"

'/* Initialize SDL */
IF SDL_Init(0) < 0 THEN
  SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, _
    !"Couldn't initialize SDL: %s\n", SDL_GetError())
  END 2
END IF

'' Create an application windw with the following settings:
VAR windw = SDL_CreateWindow( _
    "An SDL2 window", _                ' window title
    SDL_WINDOWPOS_UNDEFINED, _         ' initial x position
    SDL_WINDOWPOS_UNDEFINED, _         ' initial y position
    640, _                             ' width, in pixels
    480, _                             ' height, in pixels
    SDL_WINDOW_OPENGL _                ' flags - see below
)

'' Check that the windw was successfully made
IF windw = NULL THEN
    '// In the event that the windw could not be made...
    PRINT "Could not create windw: %s\n" & SDL_GetError() : _
    END 1
END IF

'' The windw is open (but empty): enter program loop (see SDL_PollEvent)
SDL_Delay(3000) '  // Pause execution for 3000 milliseconds, for example

'' Close and destroy the windw
SDL_DestroyWindow(windw)

'' Clean up
SDL_Quit()
