X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e306597309a120f2ae91385c731a5cb2722c52aa..df055cbbdc988141dc9687c98eb3889f332d03c0:/samples/joytest/joytest.cpp diff --git a/samples/joytest/joytest.cpp b/samples/joytest/joytest.cpp index 2709bc19ff..189314b3a8 100644 --- a/samples/joytest/joytest.cpp +++ b/samples/joytest/joytest.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// // For compilers that support precompilation, includes "wx/wx.h". @@ -20,8 +20,12 @@ #include "wx/wx.h" #endif -#include -#include +#if !wxUSE_JOYSTICK +#error You must set wxUSE_JOYSTICK to 1 in setup.h! +#endif + +#include "wx/wave.h" +#include "wx/joystick.h" #include "joytest.h" @@ -44,7 +48,9 @@ bool MyApp::OnInit(void) wxMessageBox("No joystick detected!"); return FALSE; } +#if wxUSE_WAVE m_fire.Create("gun.wav"); +#endif // wxUSE_WAVE m_maxX = stick.GetXMax(); m_maxY = stick.GetYMax(); @@ -88,7 +94,7 @@ bool MyApp::OnInit(void) } BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow) - EVT_JOYSTICK_EVENTS(MyCanvas::OnJoystickEvent) + EVT_JOYSTICK_EVENTS(MyCanvas::OnJoystickEvent) END_EVENT_TABLE() // Define a constructor for my canvas @@ -128,15 +134,17 @@ void MyCanvas::OnJoystickEvent(wxJoystickEvent& event) char buf[100]; if (event.ButtonDown()) - sprintf(buf, "Joystick (%ld, %ld) Fire!", pt.x, pt.y); + sprintf(buf, "Joystick (%d, %d) Fire!", pt.x, pt.y); else - sprintf(buf, "Joystick (%ld, %ld)", pt.x, pt.y); + sprintf(buf, "Joystick (%d, %d)", pt.x, pt.y); frame->SetStatusText(buf); +#if wxUSE_WAVE if (event.ButtonDown() && wxGetApp().m_fire.IsOk()) { wxGetApp().m_fire.Play(); } +#endif // wxUSE_WAVE } BEGIN_EVENT_TABLE(MyFrame, wxFrame)