in reply to SDL Image Slideshow
#!/usr/bin/perl use strict; use warnings; use SDL; use SDL::Video; use SDL::Rect; use SDL::Surface; use SDLx::Sprite; use SDL::GFX::Rotozoom; use SDLx::App; use SDL::Image; SDL::Image::init(IMG_INIT_JPG); #loads JPG support my $display = SDL::Video::set_video_mode( 640, 480, 32, SDL_SWSURFACE +); my $pixel = SDL::Video::map_RGB( $display->format, 0, 0, 0 ); SDL::Video::fill_rect( $display, SDL::Rect->new( 0, 0, $display->w, $display->h ), $pixel ); Carp::confess SDL::get_error if !$display; my $disp = SDLx::App->new( title => 'Ken Burns', width => 1024, height => 800, depth => 32, flags => SDL_ANYFORMAT, resizeable => 1, exit_on_quit => 1 ); #$disp->fullscreen(); my $big_image = SDL::Image::load('1Zen16.jpg'); #loads jpg print "$big_image\n"; my $lil_image = SDL::GFX::Rotozoom::surface( $big_image, 0, 0.7, SMOOT +HING_ON ); print "$lil_image\n"; draw($lil_image); #my $temp_surf = SDL::GFX::Rotozoom::shrink_surface( $big_image, .7, . +7); # shrink dos'nt work for me... gives floatingpoint errors #Carp::confess SDL::get_error if !$temp_surf; #draw( $temp_surf ); sub draw { SDL::Video::fill_rect( $display, SDL::Rect->new( 0, 0, $display->w, $display->h ), $pixel ); my $surface = $_[0]; SDL::Video::blit_surface( $surface, SDL::Rect->new( 0, 0, $surface->w, $surface->h ), $display, SDL::Rect->new( 0, 0, $display->w, $display->w ) ); SDL::Video::update_rect( $display, 0, 0, 640, 480 ); } $disp->run();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: SDL Image Slideshow
by peter.l (Initiate) on Jul 09, 2013 at 08:09 UTC |