From: Tobias Leich Date: Tue, 17 Nov 2009 18:06:58 +0000 (+0100) Subject: added images inside pod docs X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=cbc85b7fd2b7eec3e5874daf742d523e23f60d5d;p=sdlgit%2FSDL-Site.git added images inside pod docs --- diff --git a/htdocs/assets/Animation.jpg b/htdocs/assets/Animation.jpg new file mode 100644 index 0000000..005b702 Binary files /dev/null and b/htdocs/assets/Animation.jpg differ diff --git a/htdocs/assets/Cdrom.jpg b/htdocs/assets/Cdrom.jpg new file mode 100644 index 0000000..c764732 Binary files /dev/null and b/htdocs/assets/Cdrom.jpg differ diff --git a/htdocs/assets/Images_1.jpg b/htdocs/assets/Images_1.jpg new file mode 100644 index 0000000..005b702 Binary files /dev/null and b/htdocs/assets/Images_1.jpg differ diff --git a/htdocs/assets/Images_2.jpg b/htdocs/assets/Images_2.jpg new file mode 100644 index 0000000..968e050 Binary files /dev/null and b/htdocs/assets/Images_2.jpg differ diff --git a/htdocs/assets/pod.css b/htdocs/assets/pod.css index 0a266ec..1049c41 100644 --- a/htdocs/assets/pod.css +++ b/htdocs/assets/pod.css @@ -4,9 +4,15 @@ div.pod padding: 10px; } -pre +div.pod pre { border: 1px solid #FFFFFF; background-color: #CAB680; padding-top: 13px; -} \ No newline at end of file +} + +div.pod img +{ + padding-right: 13px; + border: 0; +} diff --git a/pages/SDL-Cdrom.html-inc b/pages/SDL-Cdrom.html-inc index a933869..304c392 100644 --- a/pages/SDL-Cdrom.html-inc +++ b/pages/SDL-Cdrom.html-inc @@ -84,31 +84,31 @@ It takes a SDL::Cdrom as first parameter.

play(cd,start,length,fs,fl)

Play a track from the SDL::Cdrom given as first parameter, second parameter is the frame to start, the third is the lenght to play. -It returns 1 on succés 0 on error.

+It returns 1 on succés 0 on error.

pause(cd)

Pause the playing of the SDL::Cdrom given as first parameter. -It returns 1 on succés 0 on error.

+It returns 1 on succés 0 on error.

resume(cd)

Resume the playing of the SDL::Cdrom given as first parameter. -It returns 1 on succés 0 on error.

+It returns 1 on succés 0 on error.

stop(cd)

Stop the playing of the SDL::Cdrom given as first parameter. -It returns 1 on succés 0 on error.

+It returns 1 on succés 0 on error.

eject(cd)

Eject the medium in the SDL::Cdrom given as first parameter. -It returns 1 on succés 0 on error.

+It returns 1 on succés 0 on error.

id(cd)

diff --git a/pages/SDL-Tutorial-Animation.html-inc b/pages/SDL-Tutorial-Animation.html-inc index 51fcdcf..10eafb7 100644 --- a/pages/SDL-Tutorial-Animation.html-inc +++ b/pages/SDL-Tutorial-Animation.html-inc @@ -15,7 +15,7 @@
  • COPYRIGHT

  • - +Animation.jpg

    NAME

    Top

    diff --git a/pages/SDL-Tutorial-Images.html-inc b/pages/SDL-Tutorial-Images.html-inc index 6c9aa01..6870761 100644 --- a/pages/SDL-Tutorial-Images.html-inc +++ b/pages/SDL-Tutorial-Images.html-inc @@ -16,7 +16,7 @@
  • COPYRIGHT

  • - +Images_1.jpgImages_2.jpg

    NAME

    Top

    diff --git a/pages/SDL-Video.html-inc b/pages/SDL-Video.html-inc index 107b2a9..d0828bb 100644 --- a/pages/SDL-Video.html-inc +++ b/pages/SDL-Video.html-inc @@ -84,7 +84,7 @@

    get_video_surface

    -

    It return the current SDL::Surface on succés or undef on error. +

    It return the current SDL::Surface on succés or undef on error. get_video_surface doesn't take any parameters.

    @@ -115,7 +115,7 @@ It returns 0 if the mode is not supported at all, or the suggested bpp.

    set_video_mode(width,height,bpp,flags)

    Sets up a video mode with the specified width, height, bits-per-pixel and flags. -set_video_mode returns a SDL::Surface on succés or it returns undef on error, the error message is retrieved using SDL::get_error.

    +set_video_mode returns a SDL::Surface on succés or it returns undef on error, the error message is retrieved using SDL::get_error.

    List of avalaibles flags

    @@ -220,7 +220,7 @@ The hardware will wait for vertical retrace, and then swap video buffers before On hardware that doesn't support double-buffering or if SDL_SWSURFACE was set, this is equivalent to calling SDL::update_rect(screen, 0, 0, 0, 0)

    A software screen surface is also updated automatically when parts of a SDL window are redrawn, caused by overlapping windows or by restoring from an iconified state. As a result there is no proper double buffer behavior in windowed mode for a software screen, in contrast to a full screen software mode.

    The SDL_DOUBLEBUF flag must have been passed to SDL::set_video_mode, when setting the video mode for this function to perform hardware flipping. -flip returns 0 on succés or -1 on error.

    +flip returns 0 on succés or -1 on error.

    Note : If you want to swap the buffers of an initialized OpenGL context, use the function SDL::gl_swap_buffers instead.

    @@ -361,7 +361,7 @@ Between calls to SDL::lock_surface and SDL::unlock_surface, you can write to and Once you are done accessing the surface, you should use SDL::unlock_surface to release the lock.

    Not all surfaces require locking. If SDL::MUSTLOCK(surface) evaluates to 0, then reading and writing pixels to the surface can be performed at any time, and the pixel format of the surface will not change. No operating system or library calls should be made between the lock/unlock pairs, as critical system locks may be held during this time. -SDL::lock_surface returns 0 on succés or -1 on error.

    +SDL::lock_surface returns 0 on succés or -1 on error.

    Note : Since SDL 1.1.8, the surface locks are recursive. This means that you can lock a surface multiple times, but each lock must have a matching unlock.

    @@ -379,7 +379,7 @@ It is also useful for making a copy of a surface.

    The flags parameter is passed to SDL::create_RGB_surface and has those semantics. This function is used internally by SDL::display_format. This function can only be called after SDL::init.

    -

    it returns a SDL::surface on succés or undef on error.

    +

    it returns a SDL::surface on succés or undef on error.

    display_format

    @@ -395,7 +395,7 @@ This function can only be called after SDL::init.

    load_BMP(filename)

    Loads a SDL::surface from a named Windows BMP file. -SDL::load_BMP returns a SDL::surface on succés or undef on error.

    +SDL::load_BMP returns a SDL::surface on succés or undef on error.

    Note: 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).

    @@ -409,7 +409,7 @@ SDL::load_BMP returns a SDL::surface on succés or undef on error.

    save_BMP(surface,filename)

    Saves the given SDL::Surface surface as a Windows BMP file named filename. -it returns 0 on succés or -1 on error.

    +it returns 0 on succés or -1 on error.

    set_color_key(surface,flag,key)

    @@ -421,7 +421,7 @@ If flag is SDL_SRCCOLORKEY then key is the transparent pixel value in the source

    If flag is OR'd with SDL_RLEACCEL then the surface will be drawn using RLE acceleration when drawn with SDL::Blit_surface. The surface will actually be encoded for RLE acceleration the first time SDL::blit_surface or SDL::display_format is called on the surface. If flag is 0, this function clears any current color key.

    -

    SDL::set_color_key returns 0 on succés or -1 on error.

    +

    SDL::set_color_key returns 0 on succés or -1 on error.

    @@ -484,7 +484,7 @@ If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are c

    Note: When blitting, the presence or absence of SDL_SRCALPHA is relevant only on the source surface, not the destination. Note: Note that RGBA->RGBA blits (with SDL_SRCALPHA set) keep the alpha of the destination surface. This means that you cannot compose two arbitrary RGBA surfaces this way and get the result you would expect from "overlaying" them; the destination alpha will work as a mask.

    Note: Also note that per-pixel and per-surface alpha cannot be combined; the per-pixel alpha is always used if available.

    -

    SDL::set_alpha returns 0 on succés or -1 on error.

    +

    SDL::set_alpha returns 0 on succés or -1 on error.

    set_clip_rect(surface,rect)

    @@ -524,14 +524,14 @@ SDL::blit_surface doesn't returns anything.

    If the color value contains an alpha value then the destination is simply "filled" with that alpha information, no blending takes place.

    If there is a clip rectangle set on the destination (set via SDL::set_clip_rect), then this function will clip based on the intersection of the clip rectangle and the dstrect rectangle, and the dstrect rectangle will be modified to represent the area actually filled.

    If you call this on the video surface (ie: the value of SDL::get_video_surface()) you may have to update the video surface to see the result. This can happen if you are using a shadowed surface that is not double buffered in Windows XP using build 1.2.9.

    -

    SDL::fill_rect returns 0 on succés or -1 on error.

    +

    SDL::fill_rect returns 0 on succés or -1 on error.

    GL_load_library(path)

    If you wish, you may load the OpenGL library from the given path at runtime, this must be done before SDL::set_video_mode is called. The path of the GL library is passed to SDL::GL_load_library and it returns 0 on success, or -1 on an error. You must then use SDL::GL_get_proc_address to retrieve function pointers to GL functions.

    -

    SDL::GL_load_library returns 0 on succés or -1 or error.

    +

    SDL::GL_load_library returns 0 on succés or -1 or error.

    GL_get_proc_address(proc)

    @@ -552,7 +552,7 @@ SDL::GL_get_attribute returns undef if the attribute is not found.

    This function sets the given OpenGL attribute attr to value. The requested attributes will take effect after a call to SDL::set_video_mode. You should use SDL::GL_get_attribute to check the values after a SDL::set_video_mode call, since the values obtained can differ from the requested ones. See SDL_GLattr for the full list of available attributes. -SDL::GL_set_attribute returns 0 on succés or -1 on error.

    +SDL::GL_set_attribute returns 0 on succés or -1 on error.

    Note : The SDL_DOUBLEBUF flag is not required to enable double buffering when setting an OpenGL video mode. Double buffering is enabled or disabled using the SDL_GL_DOUBLEBUFFER attribute.

    @@ -573,19 +573,19 @@ SDL::GL_swap_buffers doesn't returns any value.

    lock_YUV_overlay(overlay)

    Much the same as SDL::lock_surface, SDL::lock_YUV_overlay locks the overlay for direct access to pixel data. -It returns 0 on succés or -1 on error.

    +It returns 0 on succés or -1 on error.

    unlock_YUV_overlay(overlay)

    The opposite to SDL::lock_YUV_overlay. Unlocks a previously locked overlay. An overlay must be unlocked before it can be displayed. -It returns 0 on succés or -1 on error.

    +It returns 0 on succés or -1 on error.

    display_YUV_overlay(overlay,dstrect)

    Blit the overlay to the display surface specified when the overlay was created. The SDL::rect structure, dstrect, specifies a rectangle on the display where the overlay is drawn. The .x and .y fields of dstrect 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 optimized for 2x scaling

    -

    It returns 0 on succés or -1 on error.

    +

    It returns 0 on succés or -1 on error.

    diff --git a/pages/Time.html-inc b/pages/Time.html-inc index b1daa14..dcd6f98 100644 --- a/pages/Time.html-inc +++ b/pages/Time.html-inc @@ -102,7 +102,7 @@ However, you may always call SDL::push_event.

    remove_timer( id )

    Removes a timer callback previously added with SDL::add_timer. -It returns 0 on succés or -1 on error.

    +It returns 0 on succés or -1 on error.

    set_timer( interval,callback )

    diff --git a/tools/PM-Pod2html-snippet.pl b/tools/PM-Pod2html-snippet.pl index 8f73aa2..09c30bf 100644 --- a/tools/PM-Pod2html-snippet.pl +++ b/tools/PM-Pod2html-snippet.pl @@ -4,6 +4,7 @@ use strict; use warnings; use Carp; use Pod::Xhtml; +use File::Copy; use File::Spec::Functions qw(rel2abs splitpath splitdir catpath catdir catfile canonpath); my $input_path = 'C:/SDL_perl/lib/pods'; @@ -13,15 +14,16 @@ my ($volume, $dirs) = splitpath(rel2abs(__FILE__)); my @directories = splitdir(canonpath($dirs)); pop(@directories); my $parent_dir = catpath($volume, catdir(@directories)); -my $output_path = catdir($parent_dir, 'pages'); -my $parser = Pod::Xhtml->new(FragmentOnly => 1); +my $pages_path = catdir($parent_dir, 'pages'); +my $assets_path = catdir($parent_dir, 'htdocs/assets'); +my $parser = Pod::Xhtml->new(FragmentOnly => 1, StringMode => 1); my %module_names = (); my $fh; read_file($input_path); # creating index file -open($fh, '>', File::Spec->catfile($output_path, 'documentation.html-inc')); +open($fh, '>', File::Spec->catfile($pages_path, 'documentation.html-inc')); binmode($fh, ":utf8"); print($fh "
    \n

    Documentation (latest development branch)

    "); for my $module_name (sort keys %module_names) @@ -44,6 +46,26 @@ sub read_file read_file($_) if(-d $_); if($_ =~ /\.pod$/i) { + my $image_path = $_; + $image_path =~ s/\.pod$//; + my @images = <$image_path*>; + + my $image_html = ''; + + foreach my $image_file (@images) + { + if($image_file =~ /^($image_path)(_\d+){0,1}\.(jpg|jpeg|png|gif)$/) + { + my (undef, undef, $image_file_name) = splitpath($image_file); + + $image_html .= sprintf('' + . '%s' + . '', $image_file_name, $image_file_name, $image_file_name); + + copy($image_file, File::Spec->catfile($assets_path, $image_file_name)); + } + } + my $file_name = $_; $file_name =~ s/^$input_path\/*//; my $module_name = $file_name; @@ -54,9 +76,18 @@ sub read_file my $file_path = $file_name; $file_path =~ s/\-inc$//; $module_names{$module_name} = $file_path; - $file_name = File::Spec->catfile($output_path, $file_name); + $file_name = File::Spec->catfile($pages_path, $file_name); - $parser->parse_from_file($_, $file_name); + $parser->parse_from_file($_); #, $file_name); + + # modifying the html-snippet and insert the images + my $html = $parser->asString; + $html =~ s//$image_html
    / if $image_html; + + open($fh, '>', $file_name); + binmode($fh, ":utf8"); + print($fh $html); + close($fh); } } }