xref: /haiku/docs/user/device/Joystick.dox (revision 02354704729d38c3b078c696adc1bbbd33cbcf72)
1/*
2 * Copyright 2014 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 *
5 * Authors:
6 *      Mandar Juvekar, mjuvekar7@gmail.com
7 *
8 * Corresponds to:
9 *      headers/os/device/Joystick.h    hrev48613
10 *      src/kits/device/Joystick.cpp    hrev48613
11 */
12
13/*!
14	\file Joystick.h
15	\ingroup device
16	\brief BJoystick class definition.
17*/
18
19/*!
20	\class Joystick
21	\ingroup device
22	\brief Class that provides an interface to joysticks and game controllers.
23
24	This class allows application to access the data from game controllers of
25	any type (joysticks, gamepads, racing wheels, etc). It provides discovery
26	of the button configuration and axis layout and reports the status of the
27	buttons and position of the axis. There is also support for enumerating the
28	available controllers.
29
30	Joysticks can be accessed in two modes called standard and enhanced. The
31	standard mode is for compatibility with the BeBox joysticks and is not
32	implemented in Haiku. New applications should use the enhanced mode.
33*/
34
35/*!
36	\fn int32 BJoystick::CountDevices()
37	\brief Count the number of joysticks connected.
38
39	\return The number of joystick devices connected to the computer.
40*/
41
42/*!
43	\fn status_t BJoystick::Open(const char *portname, bool enhanced)
44	\brief Open a specific game port.
45
46	This method can be used to open the game port specified by the parameter
47	\c portname amd also allows you to specify whether to use enhanced mode or
48	not. The port name can be either an absolute path to the game port device,
49	or only the device file name.
50
51	Enhanced mode adds support for more than 32 buttons per joystick, and an
52	unlimited number of axes and thumb controls. To support this, several
53	functions allow to get information about the device, such as the button
54	count, the name of each button, and the number and name of the axis.
55
56	\param portname The name of the game port to be opened.
57	\param enhanced Specifies whether to use enhanced mode while opening the port.
58	\return B_BAD_VALUE if portname is null.
59	\return B_NO_INIT if the object failed to initialize.
60	\return B_ERROR if the specified port cannot be open.
61	\return The file descriptor for the port if it is opened succesfully.
62*/
63