<ul><li><a href="#NAME">NAME</a></li>
<li><a href="#CATEGORY">CATEGORY</a></li>
<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
+<li><a href="#CONSTANTS">CONSTANTS</a></li>
<li><a href="#Core_Functions">Core Functions</a>
<ul><li><a href="#get_video_surface">get_video_surface</a></li>
<li><a href="#get_video_info">get_video_info</a></li>
<li><a href="#wm_toggle_fullscreen">wm_toggle_fullscreen</a></li>
</ul>
</li>
-<li><a href="#AUTHOR">AUTHOR</a></li>
+<li><a href="#AUTHORS">AUTHORS</a></li>
<li><a href="#SEE_ALSO">SEE ALSO</a>
<ul><li><a href="#Category_Objects">Category Objects</a>
</li>
SDL::init(SDL_INIT_VIDEO);
# setting video mode
- my $screen_surface = SDL::Video::set_video_mode($screen_width, $screen_height, 32, SDL_SWSURFACE);
+ my $screen_surface = SDL::Video::set_video_mode($screen_width, $screen_height, 32, SDL_ANYFORMAT);
# drawing something somewhere
my $mapped_color = SDL::Video::map_RGB($screen_surface->format(), 0, 0, 255); # blue
</pre>
</div>
+<h1 id="CONSTANTS">CONSTANTS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="CONSTANTS_CONTENT">
+<p>The constants are exported by default. You can avoid this by doing:</p>
+<pre> use SDL::Video ();
+
+</pre>
+<p>and access them directly:</p>
+<pre> SDL::Video::SDL_SWSURFACE;
+
+</pre>
+<p>or by choosing the export tags below:</p>
+<p>Export tag: ':surface'</p>
+<pre> SDL_ASYNCBLIT Use asynchronous blit if possible
+ SDL_SWSURFACE Stored in the system memory.
+ SDL_HWSURFACE Stored in video memory
+
+</pre>
+<p>Export tag: ':video'</p>
+<pre> SDL_ANYFORMAT Allow any pixel-format
+ SDL_HWPALETTE Have an exclusive palette
+ SDL_DOUBLEBUF Double buffered
+ SDL_FULLSCREEN Full screen surface
+ SDL_OPENGL Have an OpenGL context
+ SDL_OPENGLBLIT Support OpenGL blitting.
+ NOTE: This option is kept for compatibility only, and is not recommended for new code.
+ SDL_RESIZABLE Resizable surface
+ SDL_NOFRAME No window caption or edge frame
+ SDL_HWACCEL Use Hardware acceleration blit
+ SDL_SRCCOLORKEY Use colorkey blitting
+ SDL_RLEACCELOK Private flag
+ SDL_RLEACCEL Accelerated colorkey blitting with RLE
+ SDL_SRCALPHA Use alpha blending blit
+ SDL_PREALLOC Use preallocated memory
+
+</pre>
+<p>Export tag ':overlay'</p>
+<pre> SDL_YV12_OVERLAY Planar mode: Y + V + U (3 planes)
+ SDL_IYUV_OVERLAY Planar mode: Y + U + V (3 planes)
+ SDL_YUY2_OVERLAY Packed mode: Y0+U0+Y1+V0 (1 plane)
+ SDL_UYVY_OVERLAY Packed mode: U0+Y0+V0+Y1 (1 plane)
+ SDL_YVYU_OVERLAY Packed mode: Y0+V0+Y1+U0 (1 plane)
+
+</pre>
+<p>Export tag ':palette'</p>
+<pre> SDL_LOGPAL Logical palette, which controls how blits are mapped to/from the surface
+ SDL_PHYSPAL Physical palette, which controls how pixels look on the screen
+
+</pre>
+<p>Export tag ':grab'</p>
+<pre> SDL_GRAB_QUERY
+ SDL_GRAB_OFF
+ SDL_GRAB_ON
+ SDL_GRAB_FULLSCREEN Used interally
+
+</pre>
+<p>Export tag ':gl'</p>
+<pre> SDL_GL_RED_SIZE
+ SDL_GL_GREEN_SIZE
+ SDL_GL_BLUE_SIZE
+ SDL_GL_ALPHA_SIZE
+ SDL_GL_BUFFER_SIZE
+ SDL_GL_DOUBLEBUFFER
+ SDL_GL_DEPTH_SIZE
+ SDL_GL_STENCIL_SIZE
+ SDL_GL_ACCUM_RED_SIZE
+ SDL_GL_ACCUM_GREEN_SIZE
+ SDL_GL_ACCUM_BLUE_SIZE
+ SDL_GL_ACCUM_ALPHA_SIZE
+ SDL_GL_STEREO
+ SDL_GL_MULTISAMPLEBUFFERS
+ SDL_GL_MULTISAMPLESAMPLES
+ SDL_GL_ACCELERATED_VISUAL
+ SDL_GL_SWAP_CONTROL
+
+</pre>
+
+</div>
<h1 id="Core_Functions">Core Functions</h1><p><a href="#TOP" class="toplink">Top</a></p>
<div id="Core_Functions_CONTENT">
<pre> my $surface = SDL::Video::get_video_surface();
</pre>
-<p>This function returns the current display <a href="/SDL-Surface.html">SDL::Surface</a>. If SDL is doing format conversion on the display surface, this
+<p>This function returns the current display <a href="SDL-Surface.html">SDL::Surface</a>. If SDL is doing format conversion on the display surface, this
function returns the publicly visible surface, not the real video surface.</p>
<p>Example:</p>
<pre> # somewhere after you set the video mode
<pre> my $video_info = SDL::Video::get_video_info();
</pre>
-<p>This function returns a read-only <a href="/SDL-VideoInfo.html">SDL::VideoInfo</a> containing information about the video hardware. If it is called before
+<p>This function returns a read-only <a href="SDL-VideoInfo.html">SDL::VideoInfo</a> containing information about the video hardware. If it is called before
<a href="#set_video_mode">SDL::Video::set_video_mode</a>, the <code>vfmt</code> member of the returned structure will contain the pixel
format of the <strong>best</strong> video mode. </p>
<p>Example:</p>
<pre> my @modes = @{ SDL::Video::list_modes( $pixel_format, $flags ) };
</pre>
-<p>Returns a ref to an array of available screen dimensions for the given format and video flags,
-or it return undef if no modes are available.</p>
+<p>Returns a reference to an array:</p>
+<ul>
+ <li>of available screen dimensions (as <code>SDL::Rect</code>'s) for the given format and video flags. </li>
+ <li>with first array element 'all'. In this case you can set all modes. </li>
+ <li>with first array element 'none' if no mode is available.</li>
+</ul>
+
+<p><strong>Note</strong>: <list_modes> should be called before the video_mode ist set. Otherwise you will always get 'all'.</p>
<p>Example:</p>
<pre> use SDL;
use SDL::Video;
if($#modes > 0)
{
print("available modes:\n");
- foreach my $index ( @modes )
+ foreach my $mode ( @modes )
{
- printf("%03d: %d x %d\n", $index, $modes[$index]->w, $modes[$index]->h );
+ printf("%d x %d\n", $mode->w, $mode->h );
}
}
elsif($#modes == 0)
</pre>
<p>Sets up a video mode with the specified width, height, bits-per-pixel and flags.
-<code>set_video_mode</code> returns a <a href="/SDL-Surface.html">SDL::Surface</a> on success otherwise it returns undef on error, the error message is retrieved
+<code>set_video_mode</code> returns a <a href="SDL-Surface.html">SDL::Surface</a> on success otherwise it returns undef on error, the error message is retrieved
using <code>SDL::get_error</code>.</p>
</div>
<pre> $converted_surface = SDL::Video::convert_surface( $surface, $format, $flags );
</pre>
-<p>Creates a new SDL::surface of the specified <a href="/SDL-PixelFormat.html">SDL::PixelFormat</a>, and then copies and maps the given surface to it.
+<p>Creates a new SDL::surface of the specified <a href="SDL-PixelFormat.html">SDL::PixelFormat</a>, and then copies and maps the given surface to it.
It is also useful for making a copy of a surface.</p>
-<p>The flags parameter is passed to <a href="/SDL-Surface.html">SDL::Surface</a><code>->new</code> and has those semantics.
+<p>The flags parameter is passed to <a href="SDL-Surface.html">SDL::Surface</a><code>->new</code> and has those semantics.
This function is used internally by <a href="#display_format">SDL::Video::display_format</a>.
This function can only be called after <code>SDL::init</code>. </p>
-<p>it returns a <a href="/SDL-Surface.html">SDL::Surface</a> on success or <code>undef</code> on error.</p>
+<p>it returns a <a href="SDL-Surface.html">SDL::Surface</a> on success or <code>undef</code> on error.</p>
</div>
<h2 id="display_format">display_format</h2>
<pre> $surface = SDL::Video::load_BMP( $filename );
</pre>
-<p>Loads a <a href="/SDL-Surface.html">SDL::Surface</a> from a named Windows BMP file.
-<code>SDL::Video::load_BMP</code> returns a <a href="/SDL-Surface.html">SDL::Surface</a> on success or <code>undef</code> on error.</p>
+<p>Loads a <a href="SDL-Surface.html">SDL::Surface</a> from a named Windows BMP file.
+<code>SDL::Video::load_BMP</code> returns a <a href="SDL-Surface.html">SDL::Surface</a> on success or <code>undef</code> on error.</p>
<p><strong>Note</strong>: When loading a 24-bit Windows BMP file, pixel data points are loaded as blue, green, red, and NOT red, green, blue (as one might expect). </p>
<pre> use SDL;
use SDL::Video;
<pre> $saved_BMP = SDL::Video::save_BMP( $surface, $filename );
</pre>
-<p>Saves the given <a href="/SDL-Surface.html">SDL::Surface</a> as a Windows BMP file named filename.
+<p>Saves the given <a href="SDL-Surface.html">SDL::Surface</a> as a Windows BMP file named filename.
it returns 0 on success or -1 on error.</p>
</div>
<pre> $fill_rect = SDL::Video::fill_rect( $dest, $dest_rect, $pixel );
</pre>
-<p>This function performs a fast fill of the given <a href="/SDL-Rect.html">SDL::Rect</a> with the given <a href="/SDL-PixelFormat.html">SDL::PixelFormat</a>. If dest_rect is NULL, the whole surface
+<p>This function performs a fast fill of the given <a href="SDL-Rect.html">SDL::Rect</a> with the given <a href="SDL-PixelFormat.html">SDL::PixelFormat</a>. If dest_rect is NULL, the whole surface
will be filled with color.</p>
<p>The color should be a pixel of the format used by the surface, and can be generated by the <a href="#map_RGB">SDL::Video::map_RGB</a> or
<code>SDL::Video::map_RGBA|/map_RGBA</code> functions. If the color value contains an alpha value then the destination is simply "filled" with that
<pre> int SDL::Video::lock_surface( $surface );
</pre>
-<p><code>SDL::Video::lock_surface</code> sets up the given <a href="/SDL-Surface.html">SDL::Surface</a> for directly accessing the pixels.
+<p><code>SDL::Video::lock_surface</code> sets up the given <a href="SDL-Surface.html">SDL::Surface</a> for directly accessing the pixels.
Between calls to SDL::lock_surface and SDL::unlock_surface, you can write to ( <code>surface-</code>set_pixels>) and read from ( <code>surface-</code>get_pixels> ),
using the pixel format stored in <code>surface-</code>format>.
Once you are done accessing the surface, you should use <a href="#unlock_surface">SDL::Video::unlock_surface</a> to release the lock.</p>
sub main
{
- carp 'Unable to init SDL: '.SDL::get_error() if( SDL::init(SDL_INIT_VIDEO) < 0);
+ Carp::cluck 'Unable to init SDL: '.SDL::get_error() if( SDL::init(SDL_INIT_VIDEO) < 0);
$screen = SDL::Video::set_video_mode( 640, 480, 32, SDL_SWSURFACE);
- carp 'Unable to set 640x480x32 video' . SDL::get_error() if(!$screen);
+ Carp::cluck 'Unable to set 640x480x32 video' . SDL::get_error() if(!$screen);
while(1)
{
<pre> SDL::Video::set_clip_rect( $surface, $rect );
</pre>
-<p>Sets the clipping rectangle for the given <a href="/SDL-Surface.html">SDL::Surface</a>. When this surface is the destination of a blit, only the area within the clip
+<p>Sets the clipping rectangle for the given <a href="SDL-Surface.html">SDL::Surface</a>. When this surface is the destination of a blit, only the area within the clip
rectangle will be drawn into.
The rectangle pointed to by rect will be clipped to the edges of the surface so that the clip rectangle for a surface can never fall
outside the edges of the surface.
<pre> SDL::Video::get_clip_rect( $surface, $rect );
</pre>
-<p>Gets the clipping rectangle for the given <a href="/SDL-Surface.html">SDL::Surface</a>. When this surface is the destination of a blit, only the area within the clip
+<p>Gets the clipping rectangle for the given <a href="SDL-Surface.html">SDL::Surface</a>. When this surface is the destination of a blit, only the area within the clip
rectangle is drawn into.
The rectangle pointed to by rect will be filled with the clipping rectangle of the surface.
<code>SDL::Video::get_clip_rect</code> doesn't returns anything;</p>
<pre> SDL::Video::blit_surface( $src_surface, $src_rect, $dest_surface, $dest_rect );
</pre>
-<p>This performs a fast blit from the given source <a href="/SDL-Surface.html">SDL::Surface</a> to the given destination <a href="/SDL-Surface.html">SDL::Surface</a>.
+<p>This performs a fast blit from the given source <a href="SDL-Surface.html">SDL::Surface</a> to the given destination <a href="SDL-Surface.html">SDL::Surface</a>.
The width and height in <code>src_surface</code> determine the size of the copied rectangle. Only the position is used in the <code>dst_rect</code>
(the width and height are ignored). Blits with negative <code>dst_rect</code> coordinates will be clipped properly.
If <code>src_rect</code> is NULL, the entire surface is copied. If <code>dst_rect</code> is NULL, then the destination position (upper left corner) is (0, 0).
<p>When surface is the surface associated with the current display, the display colormap will be updated with the requested colors.
If <code>SDL_HWPALETTE</code> was set in <a href="#set_video_mode">SDL::Video::set_video_mode</a> flags, <code>SDL::Video::set_colors</code> will always return 1, and the
palette is guaranteed to be set the way you desire, even if the window colormap has to be warped or run under emulation.
-The color components of a <a href="/SDL-Color.html">SDL::Color</a> structure are 8-bits in size, giving you a total of 2563 = 16777216 colors.
+The color components of a <a href="SDL-Color.html">SDL::Color</a> structure are 8-bits in size, giving you a total of 2563 = 16777216 colors.
Palettized (8-bit) screen surfaces with the <code>SDL_HWPALETTE</code> flag have two palettes, a logical palette that is used for mapping blits to/from
the surface and a physical palette (that determines how the hardware will map the colors to the display).
<code>SDL::Video::set_colors</code> modifies both palettes (if present), and is equivalent to calling <a href="#set_palette">SDL::Video::set_palette</a> with the
<pre> $pixel = SDL::Video::map_RGB( $pixel_format, $r, $g, $b );
</pre>
-<p>Maps the RGB color value to the specified <a href="/SDL-PixelFormat.html">SDL::PixelFormat</a> and returns the pixel value as a 32-bit int.
+<p>Maps the RGB color value to the specified <a href="SDL-PixelFormat.html">SDL::PixelFormat</a> and returns the pixel value as a 32-bit int.
If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.
If the specified pixel format has an alpha component it will be returned as all 1 bits (fully opaque). </p>
<p><code>SDL::Video::map_RGB</code> returns a pixel value best approximating the given RGB color value for a given pixel format.
-If the <a href="/SDL-PixelFormat.html">SDL::PixelFormat</a>'s bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored
+If the <a href="SDL-PixelFormat.html">SDL::PixelFormat</a>'s bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored
(e.g., with a 16-bpp format the return value can be assigned to a Uint16, and similarly a Uint8 for an 8-bpp format).</p>
<pre> use SDL;
use SDL::Video;
<pre> $pixel = SDL::Video::map_RGB( $pixel_format, $r, $g, $b, $a );
</pre>
-<p>Maps the RGBA color value to the specified <a href="/SDL-PixelFormat.html">SDL::PixelFormat</a> and returns the pixel value as a 32-bit int.
+<p>Maps the RGBA color value to the specified <a href="SDL-PixelFormat.html">SDL::PixelFormat</a> and returns the pixel value as a 32-bit int.
If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.
If the specified pixel format has no alpha component the alpha value will be ignored (as it will be in formats with a palette). </p>
<p>A pixel value best approximating the given RGBA color value for a given pixel format.
</div>
<h1 id="Video_Overlay_Functions">Video Overlay Functions</h1><p><a href="#TOP" class="toplink">Top</a></p>
<div id="Video_Overlay_Functions_CONTENT">
-<p>see <a href="/SDL-Overlay.html">SDL::Overlay</a> </p>
+<p>see <a href="SDL-Overlay.html">SDL::Overlay</a> </p>
</div>
<h2 id="lock_YUV_overlay">lock_YUV_overlay</h2>
<pre> $display_overlay = SDL::Video::display_YUV_overlay( $overlay, $dstrect );
</pre>
-<p>Blit the overlay to the display surface specified when the overlay was created. The <a href="/SDL-Rect.html">SDL::Rect</a> structure, <code>dstrect</code>, specifies a rectangle
+<p>Blit the overlay to the display surface specified when the overlay was created. The <a href="SDL-Rect.html">SDL::Rect</a> structure, <code>dstrect</code>, specifies a rectangle
on the display where the overlay is drawn. The <code>x</code> and <code>y</code> fields of <code>dstrect</code> specify the upper left location in display coordinates.
The overlay is scaled (independently in x and y dimensions) to the size specified by dstrect, and is <code>optimized</code> for 2x scaling</p>
<p>It returns <code>0</code> on success or <code>-1</code> on error.</p>
</pre>
<p>Sets the icon for the display window. Win32 icons must be 32x32.</p>
-<p>This function must be called before the first call to <a href="#set_video_mode">SDL::Video::set_video_mode</a>. Note that this means <a href="/SDL-Image.html">SDL::Image</a>
+<p>This function must be called before the first call to <a href="#set_video_mode">SDL::Video::set_video_mode</a>. Note that this means <a href="SDL-Image.html">SDL::Image</a>
cannot be used.</p>
<p>The shape is determined by the colorkey or alpha channel of the icon, if any. If neither of those are present, the icon is made opaque
(no transparency).</p>
</pre>
<p>If the application is running in a window managed environment SDL attempts to iconify/minimise it. If <code>wm_iconify_window</code> is successful,
-the application will receive a <code>SDL_APPACTIVE</code> loss event (see Application visibility events at <a href="/SDL-Event.html">SDL::Event</a>).</p>
+the application will receive a <code>SDL_APPACTIVE</code> loss event (see Application visibility events at <a href="SDL-Event.html">SDL::Event</a>).</p>
<p>Returns non-zero on success or 0 if iconification is not supported or was refused by the window manager. </p>
<p>Example:</p>
<pre> use SDL;
is experimental).</p>
</div>
-<h1 id="AUTHOR">AUTHOR</h1><p><a href="#TOP" class="toplink">Top</a></p>
-<div id="AUTHOR_CONTENT">
-<p>magnet, Tobias Leich (FROGGS)</p>
+<h1 id="AUTHORS">AUTHORS</h1><p><a href="#TOP" class="toplink">Top</a></p>
+<div id="AUTHORS_CONTENT">
+<p>See <b>AUTHORS</b> in <cite>SDL</cite>.</p>
</div>
<h1 id="SEE_ALSO">SEE ALSO</h1><p><a href="#TOP" class="toplink">Top</a></p>
</div>
<h2 id="Category_Objects">Category Objects</h2>
<div id="Category_Objects_CONTENT">
-<p><a href="/SDL-Surface.html">SDL::Surface</a>, <a href="/SDL-Overlay.html">SDL::Overlay</a>, <a href="/SDL-Color.html">SDL::Color</a>,
-<a href="/SDL-Rect.html">SDL::Rect</a>, <a href="/SDL-Palette.html">SDL::Palette</a>, <a href="/SDL-PixelFormat.html">SDL::PixelFormat</a>,
-<a href="/SDL-VideoInfo.html">SDL::VideoInfo</a></p>
+<p><a href="SDL-Surface.html">SDL::Surface</a>, <a href="SDL-Overlay.html">SDL::Overlay</a>, <a href="SDL-Color.html">SDL::Color</a>,
+<a href="SDL-Rect.html">SDL::Rect</a>, <a href="SDL-Palette.html">SDL::Palette</a>, <a href="SDL-PixelFormat.html">SDL::PixelFormat</a>,
+<a href="SDL-VideoInfo.html">SDL::VideoInfo</a></p>
</div>
</div>
\ No newline at end of file