On Saturday, 23 August 2014 at 11:07:23 UTC, ketmar via Digitalmars-d-learn wrote:
and "foo is null" is nice to read. ;-)

function bool init
begin
    rem Initialization flag
    bool success assign true;

    rem Initialize SDL
    if execute SDL_Init SDL_INIT_VIDEO lt 0
    begin
execute printf "SDL could not initialize! SDL_Error: %s\n",
execute SDL_GetError;
        success assign false;
    end
    else
    begin
        rem Create window
        gWindow assign execute SDL_CreateWindow "SDL Tutorial",
SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH,
SCREEN_HEIGHT, SDL_WINDOW_SHOWN;
        if gWindow is NULL
        begin
execute printf "Window could not be created! SDL_Error:
%s\n", execute SDL_GetError;
            success assign false;
        end
        else
        begin
            rem Get window surface
gScreenSurface assign execute SDL_GetWindowSurface gWindow;
        end;
    end;

    return success;
end;

Couldn't resist... :)

Reply via email to