home | help
LIBGAMEPAD(3)		    Library Functions Manual		   LIBGAMEPAD(3)

NAME
     libgamepad - Unix gamepad and joystick API

SYNOPSIS
     #include <libgamepad/gamepad.h>

     cc -o executable files -lgamepad

DESCRIPTION
     Libgamepad is a C library providing a standardized API for gamepad and joy-
     stick  devices  under  various Unix-like platforms.  It consists of a high-
     level device-independent, interface-independent API  layer  which	provides
     basic functionality for any USB gamepad or analog joystick.

     The  top  level API has no knowledge of devices or interfaces, and utilizes
     the lower interface-dependent layer to access the devices.

     Currently supported interfaces include the  analog  joystick  driver  (e.g.
     /dev/joy0	on  FreeBSD) and the usbhid driver (E.g. /dev/uhid0 on FreeBSD).
     Future plans include support for  the  user-level	libhid	and  potentially
     other interfaces.

API FUNCTIONS
     /* I/O */
     gamepad_t *gamepad_open(const char *device,
		    gamepad_interface_t interface, int io_flags);
     int gamepad_read(gamepad_t *gp);
     void gamepad_close(gamepad_t *gp);

     /* Accessing data from last gamepad_read() */
     int gamepad_x(gamepad_t *gp);
     int gamepad_y(gamepad_t *gp);
     int gamepad_z(gamepad_t *gp);
     int gamepad_rz(gamepad_t *gp);
     int gamepad_hat_switch(gamepad_t *gp);
     int gamepad_button(gamepad_t *gp, int button);
     int gamepad_num_buttons(gamepad_t *gp);

     /* Device information */
     int gamepad_max_x(gamepad_t *gp);
     int gamepad_max_y(gamepad_t *gp);
     int gamepad_max_z(gamepad_t *gp);
     int gamepad_max_rz(gamepad_t *gp);

     /* Mode control */
     void gamepad_set_nonblock(gamepad_t *gp);
     void gamepad_unset_nonblock(gamepad_t *gp);

FILES
     /usr/share/misc/usb_hid_usages

EXAMPLES
     Please see gamepad_test.c.

SEE ALSO
     joy(4), usbhid(3), uhid(4), usbdevs(1), libhid

BUGS
     This is an alpha quality library.	Documentation, more features, and plenty
     of bug fixes to come.

AUTHOR
     Jason W. Bacon

								   LIBGAMEPAD(3)

home | help