X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ad5c34f309074eefe625b82e1203eec5b91247f5..bc55e31bdc7fbf6f1006f298ed8310e7972984e9:/src/msw/joystick.cpp diff --git a/src/msw/joystick.cpp b/src/msw/joystick.cpp index 6f5dfcd0b5..294447cb0a 100644 --- a/src/msw/joystick.cpp +++ b/src/msw/joystick.cpp @@ -1,18 +1,14 @@ ///////////////////////////////////////////////////////////////////////////// -// 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 and Markus Holzem -// Licence: wxWindows license +// Copyright: (c) Julian Smart +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation "joystick.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -20,18 +16,15 @@ #pragma hdrstop #endif -#include - -#ifndef __GNUWIN32__ -#include -#endif +#if wxUSE_JOYSTICK -#if !defined(__WIN32__) && !defined(_MMRESULT_) -typedef UINT MMRESULT; -#endif +#include "wx/joystick.h" +#include "wx/string.h" +#include "wx/window.h" +#include "wx/msw/private.h" -#ifdef __GNUWIN32__ -#include +#if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__) + #include #endif // Why doesn't BC++ have joyGetPosEx? @@ -39,25 +32,58 @@ typedef UINT MMRESULT; #define NO_JOYGETPOSEX #endif -#include -#include +#include "wx/window.h" +#include "wx/msw/registry.h" + +#include 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