SDL2::Window - SDL Window Structure, Corresponding to Toplevel Windows
use SDL2 qw[:all]; SDL_Init(SDL_INIT_VIDEO); # Initialize SDL2 # Create an application window with the following settings; my $window = 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 ); # Check that the window was successfully created exit printf 'Could not create window: %s', SDL_GetError() if !defined $window; # The window is open: could enter program loop here (see SDL__PollEvent()) sleep 5; # Pause execution for 5 secconds, for example SDL_DestroyWindow($window); # Close and destory the window SDL_Quit(); # Clean up exit;
SDL2::Window defines a structure SDL uses to represent a window.
Every field defined is considered private. Use related functions defined in SDL2::video instead of aiming to modify this object in place.
SDL2::video
Copyright (C) Sanko Robinson.
This library is free software; you can redistribute it and/or modify it under the terms found in the Artistic License 2. Other copyrights, terms, and conditions may apply to data transmitted through this module.
Sanko Robinson <sanko@cpan.org>
To install SDL2::FFI, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SDL2::FFI
CPAN shell
perl -MCPAN -e shell install SDL2::FFI
For more information on module installation, please visit the detailed CPAN module installation guide.