1998-06-13 06:11:58 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2006-10-17 10:44:52 -04:00
|
|
|
// Name: wx/unix/joystick.h
|
1998-06-13 06:11:58 -04:00
|
|
|
// Purpose: wxJoystick class
|
|
|
|
// Author: Guilhem Lavaux
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
2005-05-04 14:57:50 -04:00
|
|
|
// Copyright: (c) Guilhem Lavaux
|
2006-10-17 10:44:52 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-06-13 06:11:58 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2007-12-02 21:55:14 -05:00
|
|
|
#ifndef _WX_UNIX_JOYSTICK_H_
|
|
|
|
#define _WX_UNIX_JOYSTICK_H_
|
1998-06-13 06:11:58 -04:00
|
|
|
|
|
|
|
#include "wx/event.h"
|
|
|
|
|
2007-07-09 06:09:52 -04:00
|
|
|
class WXDLLIMPEXP_FWD_CORE wxJoystickThread;
|
2004-05-13 22:52:05 -04:00
|
|
|
|
2007-08-06 10:52:02 -04:00
|
|
|
class WXDLLIMPEXP_ADV wxJoystick: public wxObject
|
1998-06-13 06:11:58 -04:00
|
|
|
{
|
2004-05-13 22:52:05 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxJoystick)
|
|
|
|
public:
|
|
|
|
/*
|
|
|
|
* Public interface
|
|
|
|
*/
|
|
|
|
|
|
|
|
wxJoystick(int joystick = wxJOYSTICK1);
|
2006-09-05 16:47:48 -04:00
|
|
|
virtual ~wxJoystick();
|
2004-05-13 22:52:05 -04:00
|
|
|
|
|
|
|
// Attributes
|
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
wxPoint GetPosition() const;
|
2007-03-15 20:51:43 -04:00
|
|
|
int GetPosition(unsigned axis) const;
|
|
|
|
bool GetButtonState(unsigned button) const;
|
2004-05-13 22:52:05 -04:00
|
|
|
int GetZPosition() const;
|
|
|
|
int GetButtonState() const;
|
|
|
|
int GetPOVPosition() const;
|
|
|
|
int GetPOVCTSPosition() const;
|
|
|
|
int GetRudderPosition() const;
|
|
|
|
int GetUPosition() const;
|
|
|
|
int GetVPosition() const;
|
|
|
|
int GetMovementThreshold() const;
|
|
|
|
void SetMovementThreshold(int threshold) ;
|
|
|
|
|
|
|
|
// Capabilities
|
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
bool IsOk() const; // Checks that the joystick is functioning
|
2005-11-29 07:50:13 -05:00
|
|
|
static int GetNumberJoysticks() ;
|
2004-05-13 22:52:05 -04:00
|
|
|
int GetManufacturerId() const ;
|
|
|
|
int GetProductId() const ;
|
|
|
|
wxString GetProductName() const ;
|
|
|
|
int GetXMin() const;
|
|
|
|
int GetYMin() const;
|
|
|
|
int GetZMin() const;
|
|
|
|
int GetXMax() const;
|
|
|
|
int GetYMax() const;
|
|
|
|
int GetZMax() const;
|
|
|
|
int GetNumberButtons() const;
|
|
|
|
int GetNumberAxes() const;
|
|
|
|
int GetMaxButtons() const;
|
|
|
|
int GetMaxAxes() const;
|
|
|
|
int GetPollingMin() const;
|
|
|
|
int GetPollingMax() const;
|
|
|
|
int GetRudderMin() const;
|
|
|
|
int GetRudderMax() const;
|
|
|
|
int GetUMin() const;
|
|
|
|
int GetUMax() const;
|
|
|
|
int GetVMin() const;
|
|
|
|
int GetVMax() const;
|
|
|
|
|
|
|
|
bool HasRudder() const;
|
|
|
|
bool HasZ() const;
|
|
|
|
bool HasU() const;
|
|
|
|
bool HasV() const;
|
|
|
|
bool HasPOV() const;
|
|
|
|
bool HasPOV4Dir() const;
|
|
|
|
bool HasPOVCTS() const;
|
|
|
|
|
|
|
|
// Operations
|
|
|
|
////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// pollingFreq = 0 means that movement events are sent when above the threshold.
|
|
|
|
// If pollingFreq > 0, events are received every this many milliseconds.
|
|
|
|
bool SetCapture(wxWindow* win, int pollingFreq = 0);
|
|
|
|
bool ReleaseCapture();
|
1998-06-13 06:11:58 -04:00
|
|
|
|
|
|
|
protected:
|
2004-05-13 22:52:05 -04:00
|
|
|
int m_device;
|
|
|
|
int m_joystick;
|
|
|
|
wxJoystickThread* m_thread;
|
1998-06-13 06:11:58 -04:00
|
|
|
};
|
|
|
|
|
2007-12-02 21:55:14 -05:00
|
|
|
#endif // _WX_UNIX_JOYSTICK_H_
|