Added new article
[sdlgit/SDL-Site.git] / pages / SDL-Video.html-inc
index c1c0c36..7151631 100644 (file)
@@ -5,6 +5,7 @@
 <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>
  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-&gt;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">
 
@@ -197,8 +275,14 @@ word identifier like <code>&quot;x11&quot;</code>, <code>&quot;windib&quot;</cod
 <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>: &lt;list_modes&gt; 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;
@@ -215,9 +299,9 @@ or it return undef if no modes are available.</p>
  if($#modes &gt; 0)
  {
      print(&quot;available modes:\n&quot;);
-     foreach my $index ( @modes )
+     foreach my $mode ( @modes )
      {
-         printf(&quot;%03d: %d x %d\n&quot;, $index, $modes[$index]-&gt;w, $modes[$index]-&gt;h );
+         printf(&quot;%d x %d\n&quot;, $mode-&gt;w, $mode-&gt;h );
      }
  }
  elsif($#modes == 0)