wxWidgets/docs/latex/wx/joystick.tex
Julian Smart 131f9d9b19 Applied patch [ 597700 ] Fix proposal for wxJoystick under MSW
Proposed fixes for the wxWindows joystick code under
MSW.
Some of these would be valid for other platforms, too.

Events for buttons are named wrong, docs say different.
Docs say EVT_JOY_BUTTON_DOWN and
EVT_JOY_BUTTON_UP,
but the code says EVT_JOY_DOWN and EVT_JOY_UP. I
suggest
changing the code to match the docs.

wxJoystick::GetNumberJoysticks() should be a static
member
function. Having to create a joystick object to see if there
are joysticks is silly.

Docs for GetNumberJoysticks() must be changed; it returns
the
number of potentially connected joysticks, not the number of
actually connected. Alternatively, GetNumberJoysticks() and
others must be rewritten to conform with documentation,
including
remapping of wxWindows sequential joystick ID's to match
MSW non-sequential joystick ID's.

dwSize is not set when joyGetPosEx() is called. SEVERE
ERROR.

Error return value from functions should not be a legal
return,
for instance, wxJoystick::GetPOVCTSPosition() returns 0
for error,
but this is a legal return value.

GetButtonState() supports only four (out of 32) buttons.
Also, should return as bitmap (LSB = button 1). (Win32
does this,
although not documented as such).


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16630 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2002-08-20 17:16:05 +00:00

305 lines
7.9 KiB
TeX

\section{\class{wxJoystick}}\label{wxjoystick}
wxJoystick allows an application to control one or more joysticks.
\wxheading{Derived from}
\helpref{wxObject}{wxobject}
\wxheading{Include files}
<wx/joystick.h>
\wxheading{See also}
\helpref{wxJoystickEvent}{wxjoystickevent}
\latexignore{\rtfignore{\wxheading{Members}}}
\membersection{wxJoystick::wxJoystick}\label{wxjoystickconstr}
\func{}{wxJoystick}{\param{int}{ joystick = wxJOYSTICK1}}
Constructor. {\it joystick} may be one of wxJOYSTICK1, wxJOYSTICK2, indicating the joystick
controller of interest.
\membersection{wxJoystick::\destruct{wxJoystick}}
\func{}{\destruct{wxJoystick}}{\void}
Destroys the wxJoystick object.
\membersection{wxJoystick::GetButtonState}\label{wxjoystickgetbuttonstate}
\constfunc{int}{GetButtonState}{\void}
Returns the state of the joystick buttons. Every button is mapped to a single
bit in the returned integer, with the first button being mapped to the least
significant bit, and so on.
A bitlist of wxJOY\_BUTTONn identifiers, where n is 1, 2, 3 or 4
is available for historical reasons.
\membersection{wxJoystick::GetManufacturerId}\label{wxjoystickgetmanufacturerid}
\constfunc{int}{GetManufacturerId}{\void}
Returns the manufacturer id.
\membersection{wxJoystick::GetMovementThreshold}\label{wxjoystickgetmovementthreshold}
\constfunc{int}{GetMovementThreshold}{\void}
Returns the movement threshold, the number of steps outside which the joystick is deemed to have
moved.
\membersection{wxJoystick::GetNumberAxes}\label{wxjoystickgetnumberaxes}
\constfunc{int}{GetNumberAxes}{\void}
Returns the number of axes for this joystick.
\membersection{wxJoystick::GetNumberButtons}\label{wxjoystickgetnumberbuttons}
\constfunc{int}{GetNumberButtons}{\void}
Returns the number of buttons for this joystick.
\membersection{wxJoystick::GetNumberJoysticks}\label{wxjoystickgetnumberjoysticks}
\constfunc{int}{GetNumberJoysticks}{\void}
Returns the number of joysticks currently attached to the computer.
\membersection{wxJoystick::GetPollingMax}\label{wxjoystickgetpollingmax}
\constfunc{int}{GetPollingMax}{\void}
Returns the maximum polling frequency.
\membersection{wxJoystick::GetPollingMin}\label{wxjoystickgetpollingmin}
\constfunc{int}{GetPollingMin}{\void}
Returns the minimum polling frequency.
\membersection{wxJoystick::GetProductId}\label{wxjoystickgetproductid}
\constfunc{int}{GetProductId}{\void}
Returns the product id for the joystick.
\membersection{wxJoystick::GetProductName}\label{wxjoystickgetproductname}
\constfunc{wxString}{GetProductName}{\void}
Returns the product name for the joystick.
\membersection{wxJoystick::GetPosition}\label{wxjoystickgetposition}
\constfunc{wxPoint}{GetPosition}{\void}
Returns the x, y position of the joystick.
\membersection{wxJoystick::GetPOVPosition}\label{wxjoystickgetpovposition}
\constfunc{int}{GetPOVPosition}{\void}
Returns the point-of-view position, expressed in continuous, one-hundredth of a degree units,
but limited to return 0, 9000, 18000 or 27000.
Returns -1 on error.
\membersection{wxJoystick::GetPOVCTSPosition}\label{wxjoystickgetpovctsposition}
\constfunc{int}{GetPOVCTSPosition}{\void}
Returns the point-of-view position, expressed in continuous, one-hundredth of a degree units.
Returns -1 on error.
\membersection{wxJoystick::GetRudderMax}\label{wxjoystickgetruddermax}
\constfunc{int}{GetRudderMax}{\void}
Returns the maximum rudder position.
\membersection{wxJoystick::GetRudderMin}\label{wxjoystickgetruddermin}
\constfunc{int}{GetRudderMin}{\void}
Returns the minimum rudder position.
\membersection{wxJoystick::GetRudderPosition}\label{wxjoystickgetrudderposition}
\constfunc{int}{GetRudderPosition}{\void}
Returns the rudder position.
\membersection{wxJoystick::GetUMax}\label{wxjoystickgetumax}
\constfunc{int}{GetUMax}{\void}
Returns the maximum U position.
\membersection{wxJoystick::GetUMin}\label{wxjoystickgetumin}
\constfunc{int}{GetUMin}{\void}
Returns the minimum U position.
\membersection{wxJoystick::GetUPosition}\label{wxjoystickgetuposition}
\constfunc{int}{GetUPosition}{\void}
Gets the position of the fifth axis of the joystick, if it exists.
\membersection{wxJoystick::GetVMax}\label{wxjoystickgetvmax}
\constfunc{int}{GetVMax}{\void}
Returns the maximum V position.
\membersection{wxJoystick::GetVMin}\label{wxjoystickgetvmin}
\constfunc{int}{GetVMin}{\void}
Returns the minimum V position.
\membersection{wxJoystick::GetVPosition}\label{wxjoystickgetvposition}
\constfunc{int}{GetVPosition}{\void}
Gets the position of the sixth axis of the joystick, if it exists.
\membersection{wxJoystick::GetXMax}\label{wxjoystickgetxmax}
\constfunc{int}{GetXMax}{\void}
Returns the maximum x position.
\membersection{wxJoystick::GetXMin}\label{wxjoystickgetxmin}
\constfunc{int}{GetXMin}{\void}
Returns the minimum x position.
\membersection{wxJoystick::GetYMax}\label{wxjoystickgetymax}
\constfunc{int}{GetYMax}{\void}
Returns the maximum y position.
\membersection{wxJoystick::GetYMin}\label{wxjoystickgetymin}
\constfunc{int}{GetYMin}{\void}
Returns the minimum y position.
\membersection{wxJoystick::GetZMax}\label{wxjoystickgetzmax}
\constfunc{int}{GetZMax}{\void}
Returns the maximum z position.
\membersection{wxJoystick::GetZMin}\label{wxjoystickgetzmin}
\constfunc{int}{GetXMin}{\void}
Returns the minimum z position.
\membersection{wxJoystick::GetZPosition}\label{wxjoystickgetzposition}
\constfunc{int}{GetZPosition}{\void}
Returns the z position of the joystick.
\membersection{wxJoystick::HasPOV}\label{wxjoystickhaspov}
\constfunc{bool}{HasPOV}{\void}
Returns TRUE if the joystick has a point of view control.
\membersection{wxJoystick::HasPOV4Dir}\label{wxjoystickhaspovfdir}
\constfunc{bool}{HasPOV4Dir}{\void}
Returns TRUE if the joystick point-of-view supports discrete values (centered, forward, backward, left, and right).
\membersection{wxJoystick::HasPOVCTS}\label{wxjoystickhaspovcts}
\constfunc{bool}{HasPOVCTS}{\void}
Returns TRUE if the joystick point-of-view supports continuous degree bearings.
\membersection{wxJoystick::HasRudder}\label{wxjoystickhasrudder}
\constfunc{bool}{HasRudder}{\void}
Returns TRUE if there is a rudder attached to the computer.
\membersection{wxJoystick::HasU}\label{wxjoystickhasu}
\constfunc{bool}{HasU}{\void}
Returns TRUE if the joystick has a U axis.
\membersection{wxJoystick::HasV}\label{wxjoystickhasv}
\constfunc{bool}{HasV}{\void}
Returns TRUE if the joystick has a V axis.
\membersection{wxJoystick::HasZ}\label{wxjoystickhasz}
\constfunc{bool}{HasZ}{\void}
Returns TRUE if the joystick has a Z axis.
\membersection{wxJoystick::IsOk}\label{wxjoystickisok}
\constfunc{bool}{IsOk}{\void}
Returns TRUE if the joystick is functioning.
\membersection{wxJoystick::ReleaseCapture}\label{wxjoystickreleasecapture}
\func{bool}{ReleaseCapture}{\void}
Releases the capture set by {\bf SetCapture}.
\wxheading{Return value}
TRUE if the capture release succeeded.
\wxheading{See also}
\helpref{wxJoystick::SetCapture}{wxjoysticksetcapture}, \helpref{wxJoystickEvent}{wxjoystickevent}
\membersection{wxJoystick::SetCapture}\label{wxjoysticksetcapture}
\func{bool}{SetCapture}{\param{wxWindow*}{ win}, \param{int}{ pollingFreq = 0}}
Sets the capture to direct joystick events to {\it win}.
\wxheading{Parameters}
\docparam{win}{The window that will receive joystick events.}
\docparam{pollingFreq}{If zero, movement events are sent when above the
threshold. If greater than zero, events are received every {\it pollingFreq} milliseconds.}
\wxheading{Return value}
TRUE if the capture succeeded.
\wxheading{See also}
\helpref{wxJoystick::ReleaseCapture}{wxjoystickreleasecapture}, \helpref{wxJoystickEvent}{wxjoystickevent}
\membersection{wxJoystick::SetMovementThreshold}\label{wxjoysticksetmovementthreshold}
\func{void}{SetMovementThreshold}{\param{int}{ threshold}}
Sets the movement threshold, the number of steps outside which the joystick is deemed to have
moved.