Skip to content

Loading…

Make SDLx::Music match the docs #213

Merged
merged 1 commit into from

2 participants

@ioanrogers

Make SDLx::Music match the docs:

  • data returns hashref with no args,
  • play can be called with 'name'
@FROGGS FROGGS merged commit 6dd1a29 into PerlGameDev:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 29, 2012
  1. @ioanrogers

    Make SDLx::Music match the docs: data returns hashref with no args, a…

    ioanrogers committed
    …nd play can be called with $name
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/SDLx/Music.pm
View
9 lib/SDLx/Music.pm
@@ -45,7 +45,8 @@ sub new {
sub data {
my $self = shift;
- return if $#_ < 0;
+
+ return $self->{data} if $#_ == -1;
return $self->{data}->{ $_[0] } if $#_ == 0;
my %data = @_;
@@ -92,7 +93,11 @@ sub play {
my %override = @_;
return unless defined $play_data;
-
+
+ if ( ref $play_data eq '') {
+ $play_data = $self->{data}->{$play_data};
+ }
+
my $volume = $play_data->{volume} || $override{volume} || 50;
my $fade_in = $play_data->{fade_in} || $override{fade_in} || 0;
my $loops = $play_data->{loops} || $override{loops} || 1;
Something went wrong with that request. Please try again.