]>
Commit | Line | Data |
---|---|---|
8b089c5e JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: cube.h | |
3 | // Purpose: wxGLCanvas demo program | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 04/01/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
2f6c54eb | 9 | // Licence: wxWindows licence |
8b089c5e JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_CUBE_H_ | |
13 | #define _WX_CUBE_H_ | |
14 | ||
9d705dfa | 15 | #include "wx/glcanvas.h" |
8b089c5e JS |
16 | |
17 | // Define a new application type | |
18 | class MyApp: public wxApp | |
19 | { | |
20 | public: | |
5cf036d0 | 21 | bool OnInit(); |
8b089c5e JS |
22 | }; |
23 | ||
24 | // Define a new frame type | |
25 | class TestGLCanvas; | |
5cf036d0 | 26 | |
8b089c5e JS |
27 | class MyFrame: public wxFrame |
28 | { | |
29 | public: | |
5cf036d0 | 30 | static MyFrame *Create(MyFrame *parentFrame, bool isCloneWindow = false); |
8b089c5e JS |
31 | |
32 | void OnExit(wxCommandEvent& event); | |
ec299508 VZ |
33 | void OnNewWindow(wxCommandEvent& event); |
34 | void OnDefRotateLeftKey(wxCommandEvent& event); | |
35 | void OnDefRotateRightKey(wxCommandEvent& event); | |
8b089c5e | 36 | |
5cf036d0 DS |
37 | private: |
38 | ||
39 | MyFrame(wxWindow *parent, const wxString& title, const wxPoint& pos, | |
40 | const wxSize& size, long style = wxDEFAULT_FRAME_STYLE); | |
41 | ||
42 | ||
43 | TestGLCanvas *m_canvas; | |
44 | ||
45 | DECLARE_EVENT_TABLE() | |
8b089c5e JS |
46 | }; |
47 | ||
2db98bf5 JS |
48 | #if wxUSE_GLCANVAS |
49 | ||
8b089c5e JS |
50 | class TestGLCanvas: public wxGLCanvas |
51 | { | |
5cf036d0 | 52 | friend class MyFrame; |
8b089c5e | 53 | public: |
5cf036d0 DS |
54 | TestGLCanvas( wxWindow *parent, wxWindowID id = wxID_ANY, |
55 | const wxPoint& pos = wxDefaultPosition, | |
56 | const wxSize& size = wxDefaultSize, | |
57 | long style = 0, const wxString& name = _T("TestGLCanvas") ); | |
58 | ||
8474a52c | 59 | TestGLCanvas( wxWindow *parent, const TestGLCanvas *other, |
5cf036d0 DS |
60 | wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, |
61 | const wxSize& size = wxDefaultSize, long style = 0, | |
62 | const wxString& name = _T("TestGLCanvas") ); | |
63 | ||
64 | ~TestGLCanvas(); | |
65 | ||
66 | void OnPaint(wxPaintEvent& event); | |
67 | void OnSize(wxSizeEvent& event); | |
68 | void OnEraseBackground(wxEraseEvent& event); | |
69 | void OnKeyDown(wxKeyEvent& event); | |
70 | void OnKeyUp(wxKeyEvent& event); | |
71 | void OnEnterWindow(wxMouseEvent& event); | |
72 | ||
73 | void Render(); | |
74 | void InitGL(); | |
75 | void Rotate(GLfloat deg); | |
76 | static GLfloat CalcRotateSpeed(unsigned long acceltime); | |
77 | static GLfloat CalcRotateAngle( unsigned long lasttime, | |
78 | unsigned long acceltime ); | |
79 | void Action( long code, unsigned long lasttime, | |
80 | unsigned long acceltime ); | |
81 | ||
8b089c5e | 82 | private: |
5cf036d0 DS |
83 | bool m_init; |
84 | GLuint m_gllist; | |
85 | long m_rleft; | |
86 | long m_rright; | |
87 | ||
88 | static unsigned long m_secbase; | |
89 | static int m_TimeInitialized; | |
90 | static unsigned long m_xsynct; | |
91 | static unsigned long m_gsynct; | |
92 | ||
93 | long m_Key; | |
94 | unsigned long m_StartTime; | |
95 | unsigned long m_LastTime; | |
96 | unsigned long m_LastRedraw; | |
8b089c5e JS |
97 | |
98 | DECLARE_EVENT_TABLE() | |
99 | }; | |
100 | ||
5cf036d0 | 101 | #endif // #if wxUSE_GLCANVAS |
8b089c5e | 102 | |
5cf036d0 | 103 | #endif // #ifndef _WX_CUBE_H_ |
2db98bf5 | 104 |