From: Tobias Leich Date: Thu, 26 Nov 2009 17:00:09 +0000 (+0100) Subject: docs for video X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5243265724d08e4fa937b750d1f720b1aaf78173;p=sdlgit%2FSDL-Site.git docs for video --- diff --git a/pages/SDL-Video.html-inc b/pages/SDL-Video.html-inc index a4d04aa..a805401 100644 --- a/pages/SDL-Video.html-inc +++ b/pages/SDL-Video.html-inc @@ -97,6 +97,8 @@ sleep(5); # just to have time to see it + SDL::quit(); + @@ -109,26 +111,99 @@
 my $surface = SDL::Video::get_video_surface();
 
 
-

This function returns the current display surface. If SDL is doing format conversion on the display surface, this +

This function returns the current display SDL::Surface. If SDL is doing format conversion on the display surface, this function returns the publicly visible surface, not the real video surface.

+

Example:

+
 # somewhere after you set the video mode
+ my $surface = SDL::Video::get_video_surface();
+
+ printf( "our screen is %d pixels wide and %d pixels high\n", $surface->w, $surface->h );
+
+

get_video_info

-

Returns a SDL::VideoInfo about the video hardware. -It doesn't take any parameters.

+
 my $video_info = SDL::Video::get_video_info();
+
+
+

This function returns a read-only SDL::VideoInfo containing information about the video hardware. If it is called before +SDL::Video::set_video_mode, the vfmt member of the returned structure will contain the pixel +format of the best video mode.

+

Example:

+
 use SDL;
+ use SDL::Video;
+ use SDL::VideoInfo;
+ use SDL::PixelFormat;
+
+ SDL::init(SDL_INIT_VIDEO);
+
+ my $video_info = SDL::Video::get_video_info();
+
+ printf( "we can have %dbits per pixel\n", $video_info->vfmt->BitsPerPixel );
+
+ SDL::quit();
+
+

video_driver_name

-

Return the 1024 first char of name of the video driver. -It doesn't take any parameters.

+
 my $driver_name = SDL::Video::video_driver_name();
+
+
+

This function will return the name of the initialized video driver up to a maximum of 1024 characters. The driver name is a simple one +word identifier like "x11", "windib" or "directx".

+

Note: Some platforms allow selection of the video driver through the SDL_VIDEODRIVER environment variable.

+

Example:

+
 use SDL;
+ use SDL::Video;
+
+ SDL::init(SDL_INIT_VIDEO);
+
+ print SDL::Video::video_driver_name() . "\n";
+
+ SDL::quit();
+
+

list_modes(formats,flags)

+
 my @modes = @{ SDL::Video::list_modes($video_info->vfmt, SDL_NOFRAME) };
+
+

Returns a pointer to an array of available screen dimensions for the given format and video flags, or it return undef if no modes are avalaibles.

+

Example:

+
 use SDL;
+ use SDL::Video;
+ use SDL::VideoInfo;
+ use SDL::PixelFormat;
+ use SDL::Rect;
+
+ SDL::init(SDL_INIT_VIDEO);
+
+ my $video_info = SDL::Video::get_video_info();
+
+ my @modes = @{ SDL::Video::list_modes($video_info->vfmt, SDL_NOFRAME) };
+
+ if($#modes > 0)
+ {
+     print("available modes:\n");
+     foreach my $index ( @modes )
+     {
+         printf("%03d: %d x %d\n", $index, $modes[$index]->w, $modes[$index]->h );
+     }
+ }
+ elsif($#modes == 0)
+ {
+     printf("%s video modes available\n", $modes[0]);
+ }
+
+ SDL::quit();
+
+

video_mode_ok(width,height,bpp,flags)

diff --git a/pages/documentation.html-inc b/pages/documentation.html-inc index 4ca4c25..0e3d917 100644 --- a/pages/documentation.html-inc +++ b/pages/documentation.html-inc @@ -1,2 +1,2 @@
-

Documentation (latest development branch)

Core
thumbSDL- Simple DirectMedia Layer for Perl
Structure
thumbSDL::AudioCVT- Audio Conversion Structure
thumbSDL::AudioSpec- SDL Bindings for structure SDL::AudioSpec
CDROM
thumbSDL::CDROM- SDL Bindings for the CDROM device
Structure
thumbSDL::CD- SDL Bindings for structure SDL_CD
thumbSDL::CDTrack- SDL Bindings for structure SDL_CDTrack
Events
thumbSDL::Events- Bindings to the Events Category in SDL API
Structure
thumbSDL::Event- General event structure
Joystick
thumbSDL::Joystick- SDL Bindings for the Joystick device
Structure
thumbSDL::Mixer::MixChunk- SDL Bindings for structure SDL_MixChunk
Mouse
thumbSDL::Mouse- SDL Bindings for the Mouse device
Structure
thumbSDL::Cursor- Mouse cursor structure
MultiThread
thumbSDL::MultiThread- Bindings to the MultiThread category in SDL API
Structure
thumbSDL::Version- SDL Bindings for structure SDL_Version
Video
thumbSDL::Video- Bindings to the video category in SDL API
Structure
thumbSDL::Color- Format independent color description
thumbSDL::Overlay- YUV Video overlay
thumbSDL::Palette- Color palette for 8-bit pixel formats
thumbSDL::PixelFormat- Stores surface format information
thumbSDL::Rect- Defines a rectangular area
thumbSDL::Surface- Graphic surface structure.
thumbSDL::VideoInfo- Video Target Information

Cookbook
thumbSDL::Cookbook
thumbSDL::Cookbook::PDL

Extension
thumbSDL::App- a SDL perl extension

Mixer
thumbSDL::Mixer- a SDL perl extension
TODO
Core
Audio
thumbSDL::Audio- SDL Bindings for Audio
Structure
thumbSDL::Mixer::MixMusic- SDL Bindings for structure SDL_MixMusic
Structure
thumbSDL::RWOps- SDL Bindings to SDL_RWOPs

Tutorials
thumbSDL::Tutorial- introduction to Perl SDL
thumbSDL::Tutorial::Animation
thumbSDL::Tutorial::Images
thumbSDL::Tutorial::LunarLander- a small tutorial on Perl SDL
thumbSDL::Tutorial::Pong
thumbSDL::Tutorial::Tetris

UNCATEGORIZED
thumbSDL::Font- a SDL perl extension
thumbSDL::Game::Palette- a perl extension
thumbSDL::MPEG- a SDL perl extension
thumbSDL::Music- a perl extension
thumbSDL::OpenGL- a perl extension
thumbSDL::SFont- a perl extension
thumbSDL::SMPEG- a SDL perl extension
thumbSDL::Sound- a perl extension
thumbSDL::TTFont- a SDL perl extension
thumbSDL::Timer- a SDL perl extension for managing timers.
thumbSDL::Tool::Font- a perl extension
thumbSDL::Tool::Graphic
thumbSDL::old-cdrom- a SDL perl extension for managing CD-ROM drives
+

Documentation (latest development branch)

Core
thumbSDL- Simple DirectMedia Layer for Perl
Structure
thumbSDL::AudioCVT- Audio Conversion Structure
thumbSDL::AudioSpec- SDL Bindings for structure SDL::AudioSpec
CDROM
thumbSDL::CDROM- SDL Bindings for the CDROM device
Structure
thumbSDL::CD- SDL Bindings for structure SDL_CD
thumbSDL::CDTrack- SDL Bindings for structure SDL_CDTrack
Events
thumbSDL::Events- Bindings to the Events Category in SDL API
Structure
thumbSDL::Event- General event structure
Joystick
thumbSDL::Joystick- SDL Bindings for the Joystick device
Structure
thumbSDL::Mixer::MixChunk- SDL Bindings for structure SDL_MixChunk
Mouse
thumbSDL::Mouse- SDL Bindings for the Mouse device
Structure
thumbSDL::Cursor- Mouse cursor structure
MultiThread
thumbSDL::MultiThread- Bindings to the MultiThread category in SDL API
Structure
thumbSDL::Version- SDL Bindings for structure SDL_Version
Video
thumbSDL::Video- Bindings to the video category in SDL API
Structure
thumbSDL::Color- Format independent color description
thumbSDL::Overlay- YUV Video overlay
thumbSDL::Palette- Color palette for 8-bit pixel formats
thumbSDL::PixelFormat- Stores surface format information
thumbSDL::Rect- Defines a rectangular area
thumbSDL::Surface- Graphic surface structure.
thumbSDL::VideoInfo- Video Target Information

Cookbook
thumbSDL::Cookbook
thumbSDL::Cookbook::PDL

Extension
thumbSDL::App- a SDL perl extension

Mixer
thumbSDL::Mixer- a SDL perl extension
TODO
Core
Audio
thumbSDL::Audio- SDL Bindings for Audio
Structure
thumbSDL::Mixer::MixMusic- SDL Bindings for structure SDL_MixMusic
Structure
thumbSDL::RWOps- SDL Bindings to SDL_RWOPs

Tutorials
thumbSDL::Tutorial- introduction to Perl SDL
thumbSDL::Tutorial::Animation
thumbSDL::Tutorial::Images
thumbSDL::Tutorial::LunarLander- a small tutorial on Perl SDL
thumbSDL::Tutorial::Pong
thumbSDL::Tutorial::Tetris

UNCATEGORIZED
thumbSDL::Font- a SDL perl extension
thumbSDL::Game::Palette- a perl extension
thumbSDL::MPEG- a SDL perl extension
thumbSDL::Music- a perl extension
thumbSDL::OpenGL- a perl extension
thumbSDL::SFont- a perl extension
thumbSDL::SMPEG- a SDL perl extension
thumbSDL::Sound- a perl extension
thumbSDL::TTFont- a SDL perl extension
thumbSDL::Timer- a SDL perl extension for managing timers.
thumbSDL::Tool::Font- a perl extension
thumbSDL::Tool::Graphic
thumbSDL::old-cdrom- a SDL perl extension for managing CD-ROM drives