Make wxJoystick::GetNumberJoystick a static method, as the number of
joysticks attached to the computer is a global property, not one of the specific instance. Patch from Lauri Nurmi. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36284 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -66,7 +66,7 @@ Returns the number of buttons for this joystick.
|
|||||||
|
|
||||||
\membersection{wxJoystick::GetNumberJoysticks}\label{wxjoystickgetnumberjoysticks}
|
\membersection{wxJoystick::GetNumberJoysticks}\label{wxjoystickgetnumberjoysticks}
|
||||||
|
|
||||||
\constfunc{int}{GetNumberJoysticks}{\void}
|
\func{static int}{GetNumberJoysticks}{\void}
|
||||||
|
|
||||||
Returns the number of joysticks currently attached to the computer.
|
Returns the number of joysticks currently attached to the computer.
|
||||||
|
|
||||||
|
@@ -42,7 +42,7 @@ class WXDLLEXPORT wxJoystick: public wxObject
|
|||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool IsOk() const; // Checks that the joystick is functioning
|
bool IsOk() const; // Checks that the joystick is functioning
|
||||||
int GetNumberJoysticks() const ;
|
static int GetNumberJoysticks() ;
|
||||||
int GetManufacturerId() const ;
|
int GetManufacturerId() const ;
|
||||||
int GetProductId() const ;
|
int GetProductId() const ;
|
||||||
wxString GetProductName() const ;
|
wxString GetProductName() const ;
|
||||||
|
@@ -42,7 +42,7 @@ class WXDLLEXPORT wxJoystick: public wxObject
|
|||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool IsOk() const; // Checks that the joystick is functioning
|
bool IsOk() const; // Checks that the joystick is functioning
|
||||||
int GetNumberJoysticks() const ;
|
static int GetNumberJoysticks() ;
|
||||||
int GetManufacturerId() const ;
|
int GetManufacturerId() const ;
|
||||||
int GetProductId() const ;
|
int GetProductId() const ;
|
||||||
wxString GetProductName() const ;
|
wxString GetProductName() const ;
|
||||||
|
@@ -42,7 +42,7 @@ class WXDLLEXPORT wxJoystick: public wxObject
|
|||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool IsOk() const; // Checks that the joystick is functioning
|
bool IsOk() const; // Checks that the joystick is functioning
|
||||||
int GetNumberJoysticks() const ;
|
static int GetNumberJoysticks() ;
|
||||||
int GetManufacturerId() const ;
|
int GetManufacturerId() const ;
|
||||||
int GetProductId() const ;
|
int GetProductId() const ;
|
||||||
wxString GetProductName() const ;
|
wxString GetProductName() const ;
|
||||||
|
@@ -42,7 +42,7 @@ class WXDLLEXPORT wxJoystick: public wxObject
|
|||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool IsOk() const; // Checks that the joystick is functioning
|
bool IsOk() const; // Checks that the joystick is functioning
|
||||||
int GetNumberJoysticks() const ;
|
static int GetNumberJoysticks() ;
|
||||||
int GetManufacturerId() const ;
|
int GetManufacturerId() const ;
|
||||||
int GetProductId() const ;
|
int GetProductId() const ;
|
||||||
wxString GetProductName() const ;
|
wxString GetProductName() const ;
|
||||||
|
@@ -46,7 +46,7 @@ class WXDLLEXPORT wxJoystick: public wxObject
|
|||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool IsOk() const; // Checks that the joystick is functioning
|
bool IsOk() const; // Checks that the joystick is functioning
|
||||||
int GetNumberJoysticks() const ;
|
static int GetNumberJoysticks() ;
|
||||||
int GetManufacturerId() const ;
|
int GetManufacturerId() const ;
|
||||||
int GetProductId() const ;
|
int GetProductId() const ;
|
||||||
wxString GetProductName() const ;
|
wxString GetProductName() const ;
|
||||||
|
@@ -42,7 +42,7 @@ public:
|
|||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool IsOk() const; // Checks that the joystick is functioning
|
bool IsOk() const; // Checks that the joystick is functioning
|
||||||
int GetNumberJoysticks() const ;
|
static int GetNumberJoysticks() ;
|
||||||
int GetManufacturerId() const ;
|
int GetManufacturerId() const ;
|
||||||
int GetProductId() const ;
|
int GetProductId() const ;
|
||||||
wxString GetProductName() const ;
|
wxString GetProductName() const ;
|
||||||
|
@@ -86,7 +86,7 @@ bool MyApp::OnInit()
|
|||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
frame->CreateStatusBar();
|
frame->CreateStatusBar();
|
||||||
frame->SetStatusText(wxString::Format(wxT("Device [%s] (PID:[%i] MID:[%i]) Ready... # of joysticks:[%i]"), stick.GetProductName().c_str(), stick.GetProductId(), stick.GetManufacturerId(), stick.GetNumberJoysticks()));
|
frame->SetStatusText(wxString::Format(wxT("Device [%s] (PID:[%i] MID:[%i]) Ready... # of joysticks:[%i]"), stick.GetProductName().c_str(), stick.GetProductId(), stick.GetManufacturerId(), wxJoystick::GetNumberJoysticks()));
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
frame->CenterOnScreen();
|
frame->CenterOnScreen();
|
||||||
|
@@ -90,7 +90,7 @@ bool wxJoystick::IsOk() const
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxJoystick::GetNumberJoysticks() const
|
int wxJoystick::GetNumberJoysticks()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -88,7 +88,7 @@ bool wxJoystick::IsOk() const
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxJoystick::GetNumberJoysticks() const
|
int wxJoystick::GetNumberJoysticks()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -276,7 +276,7 @@ int wxJoystick::GetNumberAxes() const
|
|||||||
// is all devices with the kHIDUsage_GD_Joystick or kHIDUsage_GD_GamePad
|
// is all devices with the kHIDUsage_GD_Joystick or kHIDUsage_GD_GamePad
|
||||||
// identifiers.
|
// identifiers.
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
int wxJoystick::GetNumberJoysticks() const
|
int wxJoystick::GetNumberJoysticks()
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
wxHIDDevice::GetCount(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick) +
|
wxHIDDevice::GetCount(kHIDPage_GenericDesktop, kHIDUsage_GD_Joystick) +
|
||||||
|
@@ -101,7 +101,7 @@ bool wxJoystick::IsOk() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxJoystick::GetNumberJoysticks() const
|
int wxJoystick::GetNumberJoysticks()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
|
@@ -283,7 +283,7 @@ bool wxJoystick::IsOk() const
|
|||||||
return (m_device != -1);
|
return (m_device != -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxJoystick::GetNumberJoysticks() const
|
int wxJoystick::GetNumberJoysticks()
|
||||||
{
|
{
|
||||||
wxString dev_name;
|
wxString dev_name;
|
||||||
int fd, j;
|
int fd, j;
|
||||||
|
@@ -87,7 +87,7 @@ bool wxJoystick::IsOk() const
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxJoystick::GetNumberJoysticks() const
|
int wxJoystick::GetNumberJoysticks()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user