| 1 | ///////////////////////////////////////////////////////////////////////////// |
| 2 | // Name: joytest.cpp |
| 3 | // Purpose: Joystick sample |
| 4 | // Author: Julian Smart |
| 5 | // Modified by: |
| 6 | // Created: 04/01/98 |
| 7 | // RCS-ID: $Id$ |
| 8 | // Copyright: (c) Julian Smart |
| 9 | // Licence: wxWindows license |
| 10 | ///////////////////////////////////////////////////////////////////////////// |
| 11 | |
| 12 | // Define a new application |
| 13 | class MyApp: public wxApp |
| 14 | { |
| 15 | public: |
| 16 | bool OnInit(); |
| 17 | |
| 18 | // Joystick max values |
| 19 | int m_minX; |
| 20 | int m_minY; |
| 21 | int m_maxX; |
| 22 | int m_maxY; |
| 23 | |
| 24 | #if wxUSE_SOUND |
| 25 | wxSound m_fire; |
| 26 | #endif // wxUSE_SOUND |
| 27 | }; |
| 28 | |
| 29 | DECLARE_APP(MyApp) |
| 30 | |
| 31 | class MyCanvas: public wxScrolledWindow |
| 32 | { |
| 33 | public: |
| 34 | MyCanvas(wxWindow *parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize); |
| 35 | ~MyCanvas(); |
| 36 | void OnJoystickEvent(wxJoystickEvent& event); |
| 37 | |
| 38 | wxJoystick* m_stick; |
| 39 | DECLARE_EVENT_TABLE() |
| 40 | }; |
| 41 | |
| 42 | class MyFrame: public wxFrame |
| 43 | { |
| 44 | public: |
| 45 | MyCanvas *canvas; |
| 46 | MyFrame(wxFrame *parent, const wxString& title, |
| 47 | const wxPoint& pos, const wxSize& size, const long style); |
| 48 | ~MyFrame(){}; |
| 49 | void OnActivate(wxActivateEvent& event); |
| 50 | void OnQuit(wxCommandEvent& event); |
| 51 | |
| 52 | DECLARE_EVENT_TABLE() |
| 53 | }; |
| 54 | |
| 55 | #define JOYTEST_QUIT 1 |