X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2049ba38adafa0ec146880de29f26e32dd69a125..0a68bc69086f122b9f7166f505c415db9ee21afe:/samples/joytest/joytest.cpp diff --git a/samples/joytest/joytest.cpp b/samples/joytest/joytest.cpp index 862663ff30..a073793928 100644 --- a/samples/joytest/joytest.cpp +++ b/samples/joytest/joytest.cpp @@ -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(); @@ -52,7 +58,7 @@ bool MyApp::OnInit(void) // Create the main frame window frame = new MyFrame(NULL, "Joystick Demo", wxPoint(0, 0), wxSize(500, 400), - wxDEFAULT_FRAME | wxHSCROLL | wxVSCROLL); + wxDEFAULT_FRAME_STYLE | wxHSCROLL | wxVSCROLL); // Give it an icon (this is ignored in MDI mode: uses resources) #ifdef __WXMSW__ @@ -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) @@ -164,8 +172,3 @@ void MyFrame::OnActivate(wxActivateEvent& event) if (event.GetActive() && canvas) canvas->SetFocus(); } - -bool MyFrame::OnClose(void) -{ - return TRUE; -} \ No newline at end of file