X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2bda0e173844e8e0f8acf4e8ad8b5c26e5c6fe5d..b5435dccd098ae153c3b7b3b8fca8dd0d763986c:/src/msw/joystick.cpp?ds=inline diff --git a/src/msw/joystick.cpp b/src/msw/joystick.cpp index 7911b1338f..eb5ea63c87 100644 --- a/src/msw/joystick.cpp +++ b/src/msw/joystick.cpp @@ -5,8 +5,8 @@ // 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__ @@ -16,22 +16,24 @@ // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" -#if defined(__BORLANDC__) +#ifdef __BORLANDC__ #pragma hdrstop #endif -#include +#include "wx/string.h" +#include "wx/window.h" +#include "wx/msw/private.h" -#ifndef __GNUWIN32__ -#include +#if !defined(__GNUWIN32_OLD__) || defined(__CYGWIN10__) + #include #endif #if !defined(__WIN32__) && !defined(_MMRESULT_) typedef UINT MMRESULT; #endif -#ifdef __GNUWIN32__ -#include +#ifdef __GNUWIN32_OLD__ +#include "wx/msw/gnuwin32/extra.h" #endif // Why doesn't BC++ have joyGetPosEx? @@ -39,14 +41,46 @@ typedef UINT MMRESULT; #define NO_JOYGETPOSEX #endif -#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 wxJoystick::GetNumberJoysticks(void) const + int i, maxsticks, actualsticks; + maxsticks = joyGetNumDevs(); + actualsticks = 0; + for( i=0; i