X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/65fd5cb0124e62ab1fc41f93382a205d95b00e75..ddc5c471d4d8d185e9f2bb9c91c92ddd3a2afff8:/src/msw/joystick.cpp diff --git a/src/msw/joystick.cpp b/src/msw/joystick.cpp index 58b7631915..d09e443a91 100644 --- a/src/msw/joystick.cpp +++ b/src/msw/joystick.cpp @@ -5,11 +5,11 @@ // Modified by: // Created: 04/01/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Copyright: (c) Julian Smart +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #pragma implementation "joystick.h" #endif @@ -24,46 +24,69 @@ #include "wx/window.h" #include "wx/msw/private.h" -#if !defined( __GNUWIN32__ ) || defined(wxUSE_NORLANDER_HEADERS) -#include +#if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__) + #include #endif #if !defined(__WIN32__) && !defined(_MMRESULT_) typedef UINT MMRESULT; #endif -#ifndef __TWIN32__ -#ifdef __GNUWIN32__ -#ifndef wxUSE_NORLANDER_HEADERS -#include -#endif -#endif -#endif - // Why doesn't BC++ have joyGetPosEx? -#if !defined(__WIN32__) || defined(__BORLANDC__) || defined(__TWIN32__) +#if !defined(__WIN32__) || defined(__BORLANDC__) #define NO_JOYGETPOSEX #endif -#include -#include +#include "wx/window.h" +#include "wx/msw/joystick.h" IMPLEMENT_DYNAMIC_CLASS(wxJoystick, wxObject) // Attributes //////////////////////////////////////////////////////////////////////////// -wxPoint wxJoystick::GetPosition(void) const +/** + 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 0) || (res == JOYERR_NOERROR)); + int i, maxsticks, actualsticks; + maxsticks = joyGetNumDevs(); + actualsticks = 0; + for( i=0; i