Hi all,
I'm trying to write a simple alpha cross-fade app: basically a slideshow
that fades one image in and the other out. However, can not get alpha fades
to work.
I'm very new to SDL, so please don't laugh at my code! But I'd be very
grateful if anyone could point out where I'm going wrong. The code snippet
below results in the image being displayed without any change.
Many thanks,
Karl Dane
#!/usr/bin/perl
use warnings;
use SDL::App;
our $app = SDL::App->new(
-width => 640,
-height => 480,
-depth => 24,
-fullscreen => 0,
);
for ($i=260; $i >=0; $i-=1) {
print "$i\n";
my $img1 = SDL::Surface->new( -name => "./img1.png" );
$img1->display_format();
$img1->set_alpha(SDL_SRCALPHA, $i);
$img1->blit( SDL::Rect->new(
-width => 640, -height => 480), $app, undef);
$app->sync;
}