2015-01-06 18:20:28 +05:30
|
|
|
/*
|
|
|
|
* 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-09 18:44:30 +05:30
|
|
|
/*!
|
|
|
|
\file Joystick.h
|
|
|
|
\ingroup device
|
|
|
|
\brief BJoystick class definition.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\class Joystick
|
|
|
|
\ingroup device
|
|
|
|
\brief Class that provides an interface to a joystick and other similar game
|
|
|
|
controllers.
|
|
|
|
|
|
|
|
This class adds support for joysticks and other similar game controllers
|
|
|
|
through game ports, both, on cards and some build-in ports.
|
|
|
|
|
|
|
|
The class also provides two modes - standard and enhanced
|
|
|
|
*/
|
|
|
|
|
2015-01-06 18:20:28 +05:30
|
|
|
/*!
|
|
|
|
\fn int32 BJoystick::CountDevices()
|
|
|
|
\brief Count the number of joysticks connected.
|
|
|
|
|
|
|
|
\return The number of joystick devices connected.
|
|
|
|
*/
|
2015-01-09 18:44:30 +05:30
|
|
|
|
|
|
|
/*!
|
|
|
|
\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.
|
|
|
|
|
|
|
|
Enhanced mode adds support for up to 32 buttons per joystick, an indefinite
|
|
|
|
number of axes and thumb controls, and also allows you to connect multiple
|
|
|
|
joysticks to a single game port. It provides several methods to determine
|
|
|
|
the state of a joystick and also a preference application.
|
|
|
|
|
|
|
|
Enhanced mode also provides a mechanism to determine what joysticks are
|
|
|
|
available and what types of and how many controls are available on them.
|
|
|
|
|
|
|
|
\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.
|
|
|
|
B_ERROR if the specified port is unable to open or if portname is not valid.
|
|
|
|
A positive integer if the port is opened succesfully.
|
|
|
|
\see CountDevices()
|
|
|
|
GetDeviceName()
|
|
|
|
*/
|