haiku/docs/user/device/Joystick.dox

63 lines
2.2 KiB
Plaintext
Raw Normal View History

/*
* Copyright 2014 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Mandar Juvekar, mjuvekar7@gmail.com
*
* Corresponds to:
* headers/os/device/Joystick.h hrev48613
* src/kits/device/Joystick.cpp hrev48613
*/
/*!
2015-01-10 13:44:58 +03:00
\file Joystick.h
\ingroup device
\brief BJoystick class definition.
*/
/*!
2015-01-10 13:44:58 +03:00
\class Joystick
\ingroup device
\brief Class that provides an interface to joysticks and game controllers.
This class allows application to access the data from game controllers of
any type (joysticks, gamepads, racing wheels, etc). It provides discovery
of the button configuration and axis layout and reports the status of the
buttons and position of the axis. There is also support for enumerating the
available controllers.
Joysticks can be accessed in two modes called standard and enhanced. The
standard mode is for compatibility with the BeBox joysticks and is not
implemented in Haiku. New applications should use the enhanced mode.
*/
/*!
2015-01-10 13:44:58 +03:00
\fn int32 BJoystick::CountDevices()
\brief Count the number of joysticks connected.
2015-01-10 13:44:58 +03:00
\return The number of joystick devices connected to the computer.
*/
/*!
2015-01-10 13:44:58 +03:00
\fn status_t BJoystick::Open(const char *portname, bool enhanced)
\brief Open a specific game port.
This method can be used to open the game port specified by the parameter
\c portname amd also allows you to specify whether to use enhanced mode or
not. The port name can be either an absolute path to the game port device,
or only the device file name.
Enhanced mode adds support for more than 32 buttons per joystick, and an
unlimited number of axes and thumb controls. To support this, several
functions allow to get information about the device, such as the button
count, the name of each button, and the number and name of the axis.
\param portname The name of the game port to be opened.
\param enhanced Specifies whether to use enhanced mode while opening the port.
\return B_BAD_VALUE if portname is null.
\return B_NO_INIT if the object failed to initialize.
\return B_ERROR if the specified port cannot be open.
\return The file descriptor for the port if it is opened succesfully.
*/