Changes to simplify LoadVirtualSprite
This commit is contained in:
parent
53075c961f
commit
c7136d010c
|
|
@ -181,32 +181,31 @@ sub LoadVirtualSprite {
|
|||
return $files{$name};
|
||||
}
|
||||
|
||||
foreach (@files) {
|
||||
if(!LoadAsset($_)) {
|
||||
LogData(ERROR, "Unable to load virtual sprite, error loading one or more assets.");
|
||||
return undef;
|
||||
}
|
||||
LogData(DEBUG, "Adding asset $_ to virtual sprite $name");
|
||||
}
|
||||
|
||||
my @frames = map { $files{$_}{'Sprite'}->surface() } (@files);
|
||||
my $h = $frames[0]->height();
|
||||
my @frames = map { GetAsset($_) || return } (@files);
|
||||
my $h = $frames[0]->surface()->height();
|
||||
my $hp = 0;
|
||||
|
||||
my $newsurface = SDLx::Surface->new( width => $frames[0]->width(),
|
||||
LogData(INFO, sprintf("Format = '%s', Pitch = '%s'",
|
||||
$frames[0]->surface()->format(),
|
||||
));
|
||||
exit(0);
|
||||
|
||||
my $newsurface = SDLx::Surface->new( width => $frames[0]->surface()->width(),
|
||||
height => $h * (@frames-0),
|
||||
format => $frames[0]->format(),
|
||||
pitch => $frames[0]->pitch(),
|
||||
flags => $frames[0]->flags(),
|
||||
format => $frames[0]->surface()->format(),
|
||||
pitch => $frames[0]->surface()->pitch(),
|
||||
flags => $frames[0]->surface()->flags(),
|
||||
color => [0, 0, 0, 255],
|
||||
);
|
||||
$newsurface->draw_rect( [0, 0, $newsurface->width(), $newsurface->height()], [0, 0, 0, 255]);
|
||||
#SDL::Video::set_alpha( $newsurface, SDL::Video::SDL_SRCALPHA, 0);
|
||||
|
||||
#SDL::Video::set_alpha($newsurface, SDL::Video::SDL_RLEACCEL, 0);
|
||||
#my $f = SDL::Video::SDL_SRCALPHA | SDL::Video::SDL_RLEACCEL;
|
||||
foreach (@frames) {
|
||||
#SDL::Video::set_alpha( $_, SDL::Video::SDL_SRCALPHA, 255);
|
||||
#FIXME - This call ignores the source alpha channel
|
||||
$_->blit( $newsurface, undef, [0, $hp, $_->width(), $_->height()]);
|
||||
#SDL::Video::set_alpha( $_->surface(), $f, 0);
|
||||
$_->draw_xy($newsurface, 0, $hp);
|
||||
$hp += $h;
|
||||
}
|
||||
#SDL::Video::set_alpha($newsurface, $f, 0);
|
||||
|
||||
my $anim = SDLx::Sprite::Animated->new( surface => $newsurface,
|
||||
width => $newsurface->width(),
|
||||
|
|
@ -220,5 +219,4 @@ sub LoadVirtualSprite {
|
|||
return $anim;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Reference in New Issue