X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/77ffb5937e89927b621128789401db8921fe580f..69d31e313035d5e22d9400ec946f6007f710910c:/src/msw/joystick.cpp diff --git a/src/msw/joystick.cpp b/src/msw/joystick.cpp index 96c6d7d136..1b9f8b04ce 100644 --- a/src/msw/joystick.cpp +++ b/src/msw/joystick.cpp @@ -1,39 +1,34 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: joystick.cpp +// Name: src/msw/joystick.cpp // Purpose: wxJoystick class // Author: Julian Smart // Modified by: // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWidgets licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "joystick.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" #ifdef __BORLANDC__ -#pragma hdrstop + #pragma hdrstop #endif -#include "wx/string.h" -#include "wx/window.h" -#include "wx/msw/private.h" +#if wxUSE_JOYSTICK -#if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__) - #include -#endif +#include "wx/joystick.h" -#if !defined(__WIN32__) && !defined(_MMRESULT_) -typedef UINT MMRESULT; +#ifndef WX_PRECOMP + #include "wx/string.h" + #include "wx/window.h" #endif -#ifdef __GNUWIN32_OLD__ -#include "wx/msw/gnuwin32/extra.h" +#include "wx/msw/private.h" + +#if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__) + #include #endif // Why doesn't BC++ have joyGetPosEx? @@ -41,8 +36,9 @@ typedef UINT MMRESULT; #define NO_JOYGETPOSEX #endif -#include "wx/window.h" -#include "wx/msw/joystick.h" +#include "wx/msw/registry.h" + +#include IMPLEMENT_DYNAMIC_CLASS(wxJoystick, wxObject) @@ -50,35 +46,35 @@ IMPLEMENT_DYNAMIC_CLASS(wxJoystick, wxObject) //////////////////////////////////////////////////////////////////////////// /** - johan@linkdata.se 2002-08-20: - Now returns only valid, functioning - joysticks, counting from the first - available and upwards. + johan@linkdata.se 2002-08-20: + Now returns only valid, functioning + joysticks, counting from the first + available and upwards. */ wxJoystick::wxJoystick(int joystick) { JOYINFO joyInfo; - int i, maxsticks; - - maxsticks = joyGetNumDevs(); - for( i=0; i sizeof(int) * 8) + return false; + + return (GetButtonState() & (1 << id)) != 0; +} + /** - JLI 2002-08-20: - Returns -1 to signify error. + JLI 2002-08-20: + Returns -1 to signify error. */ int wxJoystick::GetPOVPosition() const { @@ -154,8 +178,8 @@ int wxJoystick::GetPOVPosition() const } /** - johan@linkdata.se 2002-08-20: - Returns -1 to signify error. + johan@linkdata.se 2002-08-20: + Returns -1 to signify error. */ int wxJoystick::GetPOVCTSPosition() const { @@ -251,30 +275,30 @@ void wxJoystick::SetMovementThreshold(int threshold) //////////////////////////////////////////////////////////////////////////// /** - johan@linkdata.se 2002-08-20: - Now returns the number of connected, functioning - joysticks, as intended. + johan@linkdata.se 2002-08-20: + Now returns the number of connected, functioning + joysticks, as intended. */ int wxJoystick::GetNumberJoysticks() { JOYINFO joyInfo; - int i, maxsticks, actualsticks; - maxsticks = joyGetNumDevs(); - actualsticks = 0; - for( i=0; i