X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/65442ab650425a5f6a1d5d685e8df582401a9be7..e6bfb8a131f1699253218dbfcf30316df8120d76:/samples/joytest/joytest.cpp diff --git a/samples/joytest/joytest.cpp b/samples/joytest/joytest.cpp index 403ea91a8e..0da7193b51 100644 --- a/samples/joytest/joytest.cpp +++ b/samples/joytest/joytest.cpp @@ -43,6 +43,9 @@ int nButtons = 0; // Initialise this in OnInit, not statically bool MyApp::OnInit() { + if ( !wxApp::OnInit() ) + return false; + wxJoystick stick(wxJOYSTICK1); if (!stick.IsOk()) { @@ -51,7 +54,7 @@ bool MyApp::OnInit() } #if wxUSE_SOUND - m_fire.Create(_T("gun.wav")); + m_fire.Create(_T("buttonpress.wav")); #endif // wxUSE_SOUND m_minX = stick.GetXMin(); @@ -86,7 +89,7 @@ bool MyApp::OnInit() #if wxUSE_STATUSBAR 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 frame->CenterOnScreen(); @@ -162,11 +165,11 @@ void MyCanvas::OnJoystickEvent(wxJoystickEvent& event) /* for(int i = 0; i < nButtons; ++i) { - buf += wxString(wxT("[")) + + buf += wxString(wxT("[")) + ((event.GetButtonState() & (1 << i)) ? wxT("Y") : wxT("N")) + wxString(wxT("]")); } */ - + frame->SetStatusText(buf); #endif // wxUSE_STATUSBAR