Main > Programming > Libraries >

Linux::Joystick 0.0.1

Linux::Joystick 0.0.1

Sponsored Links

Linux::Joystick 0.0.1 Ranking & Summary

RankingClick at the star to rank
Ranking Level
User Review: 0 (0 times)
File size: 0.022 MB
Platform: Any Platform
License: Perl Artistic License
Price:
Downloads: 1027
Date added: 2007-01-05
Publisher: B. Watson

Linux::Joystick 0.0.1 description

Linux::Joystick is an object-oriented, pure Perl API for accessing joystick devices under Linux-based operating systems. Linux::Joystick module is capable of using either blocking or non-blocking I/O, and represents each axis change or button press as a Linux::Joystick::Event object.

USAGE

If you want your application to be driven by joystick events, use blocking I/O and an event loop:

use Linux::Joystick;

my $js = new Linux::Joystick;
my $event;

print "Joystick has " . $js->buttonCount() . " buttons ".
"and " . $js->axisCount() . " axes.n";

# blocking reads:
while( $event = $js->nextEvent ) {

print "Event type: " . $event->type . ", ";
if($event->isButton) {
print "Button " . $event->button;
if($event->buttonDown) {
print " pressed";
} else {
print " released";
}
} elsif($event->isAxis) {
print "Axis " . $event->axis . ", value " . $event->axisValue . ", ";
print "UP" if $event->stickUp;
print "DOWN" if $event->stickDown;
print "LEFT" if $event->stickLeft;
print "RIGHT" if $event->stickRight;
} else { # should never happen
print "Unknown event " . $event->hexDump;
}

print "n";
}

# if the while loop terminates, we got a false (undefined) event:
die "Error reading joystick: " . $js->errorString;

You can also use non-blocking I/O, in which case nextEvent() returning undef just means there was no event to read:

my $js = Linux::Joystick->new(nonblocking => 1);
# use this to open 2nd joystick in nonblocking mode instead:
# my $js = Linux::Joystick->new(device => 1, nonblocking => 1);

while(1) {
my $event = $js->nextEvent;

if($event) {
print "Got a joystick eventn";
# process the event here
}

# Do other processing here (graphics, sound, I/O, calculation)

}

It is possible to switch between blocking and non-blocking I/O without reopening the device (see the setNonblocking() method, below).

Linux::Joystick 0.0.1 Screenshot

Advertisements

Linux::Joystick 0.0.1 Keywords

Bookmark Linux::Joystick 0.0.1

Hyperlink code:
Link for forum:

Linux::Joystick 0.0.1 Copyright

WareSeeker periodically updates pricing and software information of Linux::Joystick 0.0.1 full version from the publisher, so some information may be slightly out-of-date. You should confirm all information before relying on it. Software piracy is theft, Using crack, password, serial numbers, registration codes, key generators is illegal and prevent future development of Linux::Joystick 0.0.1 Edition. Download links are directly from our publisher sites, torrent files or links from rapidshare.com, yousendit.com or megaupload.com are not allowed

Allok Video Splitter 2.2.0 Review:

Name (Required)
Email(Required)
Captcha
Featured Software

Want to place your software product here?
Please contact us for consideration.

Contact WareSeeker.com
Related Software
Linux::Input::Joystick is a joystick-specific interface for Linux 2.2+ Free Download
LibOSDK is an operating systems development toolkit. Free Download
Joystick is a utility to read commands from joystick and send to BMPx via DBUS. Free Download
Linux Commander is a file manager for X11 using GTK+. Free Download
Elisa is a project to create a media center solution for GNU/Linux and Unix operating systems. Free Download
ASTUce is a regression testing framework for ECMAScript inspired by the xUnit architecture. Free Download
Perl/Linux is a Linux distribution where ALL programs are written in perl. Free Download
Linux::Input is a Linux input event interface. Free Download