```{index} single: SDL_CreateWindow (SDL2) ``` ```{index} single: SDL2::SDL_CreateWindow ``` # SDL_CreateWindow Creates a window and returns its handle, or undef on failure. ```perl my $win = SDL_CreateWindow($title, $x, $y, $w, $h, $flags); ``` `$x` and `$y` are pixel positions, or `SDL_WINDOWPOS_CENTERED` / `SDL_WINDOWPOS_UNDEFINED`. `$flags` is the OR of `SDL_WINDOW_*` constants - `SDL_WINDOW_SHOWN` to make it visible immediately, `SDL_WINDOW_OPENGL` if it will carry an OpenGL context, `SDL_WINDOW_RESIZABLE` to let the user resize it. The window must be freed with `SDL_DestroyWindow`. `SDL2::Window->new` is the same call with a Perl object that frees itself.