Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: kthakore/pangzero
base: 733630ece4
...
head fork: kthakore/pangzero
compare: d6eb5afe78
Checking mergeability… Don't worry, you can still create the pull request.
  • 4 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
3  Build.PL
@@ -24,7 +24,8 @@ my $build = Module::Build->new(
},
meta_merge => {
resources => {
- repository => 'http://github.com/kthakore/pangzero'
+ bugtracker => 'http://github.com/kthakore/pangzero/issues',
+ repository => 'http://github.com/kthakore/pangzero'
}
},
share_dir => 'data',
View
12 ChangeLog
@@ -1,7 +1,11 @@
-2012-01-31 09:43 FROGGS
- * ChangeLog, VERSION, *.p[l/m]: Bumped version to 1.4, making pangzero
- work with upstream release of SDL. Many fixes.
- See http://cpansearch.perl.org/src/FROGGS/SDL-2.536/CHANGELOG
+
+2012-03-12 19:42 FROGGS
+ * 1.401, fix for SDL's Joystick API
+
+2012-02-21 22:27 kthakore, FROGGS
+ * ChangeLog, VERSION, *.p[l/m]: Bumped version to 1.4, making pangzero
+ work with upstream release of SDL. Many fixes.
+ See http://cpansearch.perl.org/src/FROGGS/SDL-2.536/CHANGELOG
2007-07-15 10:12 upi
View
2  lib/Games/PangZero.pm
@@ -1,7 +1,7 @@
package Games::PangZero;
$Cheat = 0;
-$VERSION = '1.4';
+$VERSION = '1.401';
$DataDir = ''; # Set it to a path to avoid autodetection (e.g. /opt/pangzero/data)
=comment
View
27 lib/Games/PangZero/Joystick.pm
@@ -7,12 +7,12 @@ use vars qw(@Games::PangZero::Joysticks @Games::PangZero::JoystickButtons);
sub InitJoystick {
my ($numJoysticks, $joystick, $numButtons, $i);
- $numJoysticks = &SDL::Joystick::num_joysticks();
- for ($i = 0; $i < $numJoysticks; ++$i) {
- print STDERR "Found joystick " , $i+1 , ": " , &SDL::Joystick::open($i), "\n";
- $joystick = &SDL::Joystick::open($i);
+ $numJoysticks = SDL::Joystick::num_joysticks();
+ for ($i = 0; $i < $numJoysticks; $i++) {
+ print STDERR "Found joystick " , $i+1 , ": " , SDL::Joystick::name($i), "\n";
+ $joystick = SDL::Joystick->new($i);
next unless $joystick;
- $numButtons = &SDL::Joystick::open($joystick);
+ $numButtons = SDL::Joystick::num_buttons($joystick);
next unless $numButtons;
push @Games::PangZero::Joysticks, $joystick;
push @Games::PangZero::JoystickButtons, $numButtons;
@@ -25,9 +25,8 @@ sub ReadJoystick {
my ($i, $button, $buttonPressed);
$i = 0;
- foreach my $joystick (@Joysticks) {
- ++$i;
- my $axis = &SDL::Joystick::get_axis($joystick, 0);
+ foreach my $joystick (@Games::PangZero::Joysticks) {
+ my $axis = SDL::Joystick::get_axis($joystick, 0);
if ($axis <= -10000) {
$Games::PangZero::Events{"L$i"} = $Games::PangZero::MenuEvents{LEFT} = 1 unless $Games::PangZero::Keys{"L$i"};
$Games::PangZero::Keys{"L$i"} = 1;
@@ -40,8 +39,9 @@ sub ReadJoystick {
$Games::PangZero::Keys{"L$i"} = 0;
$Games::PangZero::Keys{"R$i"} = 0;
}
+
if ($readBothAxes) {
- $axis = &SDL::Joystick::get_axis($joystick, 1);
+ $axis = SDL::Joystick::get_axis($joystick, 1);
if ($axis <= -10000) {
$Games::PangZero::Events{"U$i"} = $Games::PangZero::MenuEvents{UP} = 1 unless $Games::PangZero::Keys{"U$i"};
$Games::PangZero::Keys{"U$i"} = 1;
@@ -55,16 +55,19 @@ sub ReadJoystick {
$Games::PangZero::Keys{"U$i"} = 0;
}
}
+
$buttonPressed = 0;
- for ($button = 0; $button < $JoystickButtons[$i-1]; ++$button) {
- if (&SDL::Joystick::get_button($joystick, $button)) {
- $buttonPressed = 1; last;
+ for ($button = 0; $button < $Games::PangZero::JoystickButtons[$i]; $button++) {
+ if (SDL::Joystick::get_button($joystick, $button)) {
+ $buttonPressed = 1;
+ last;
}
}
if ($buttonPressed and not $Games::PangZero::Keys{"B$i"}) {
$Games::PangZero::Events{"B$i"} = $Games::PangZero::MenuEvents{BUTTON} = 1;
}
$Games::PangZero::Keys{"B$i"} = $buttonPressed;
+ $i++;
}
}

No commit comments for this range

Something went wrong with that request. Please try again.