]> git.saurik.com Git - wxWidgets.git/blame - samples/opengl/cube/cube.h
Changed all symbols with the name "id" to "timerid" to allow Objective-C++
[wxWidgets.git] / samples / opengl / cube / cube.h
CommitLineData
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
18class MyApp: public wxApp
19{
20public:
21 bool OnInit(void);
22};
23
24// Define a new frame type
25class TestGLCanvas;
26class MyFrame: public wxFrame
27{
28public:
29 MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos,
30 const wxSize& size, long style = wxDEFAULT_FRAME_STYLE);
31
32 void OnExit(wxCommandEvent& event);
ec299508
VZ
33 void OnNewWindow(wxCommandEvent& event);
34 void OnDefRotateLeftKey(wxCommandEvent& event);
35 void OnDefRotateRightKey(wxCommandEvent& event);
8b089c5e
JS
36
37public:
38 TestGLCanvas* m_canvas;
39
40DECLARE_EVENT_TABLE()
41};
42
2db98bf5
JS
43#if wxUSE_GLCANVAS
44
8b089c5e
JS
45class TestGLCanvas: public wxGLCanvas
46{
47 friend class MyFrame;
48public:
49 TestGLCanvas(wxWindow *parent, const wxWindowID id = -1,
50 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
2db98bf5 51 long style = 0, const wxString& name = _T("TestGLCanvas"));
8b089c5e
JS
52 TestGLCanvas(wxWindow *parent, const TestGLCanvas &other,
53 const wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
54 const wxSize& size = wxDefaultSize, long style = 0,
2db98bf5 55 const wxString& name = _T("TestGLCanvas") );
8b089c5e
JS
56
57 ~TestGLCanvas(void);
58
59 void OnPaint(wxPaintEvent& event);
60 void OnSize(wxSizeEvent& event);
61 void OnEraseBackground(wxEraseEvent& event);
62 void OnKeyDown(wxKeyEvent& event);
63 void OnKeyUp(wxKeyEvent& event);
64 void OnEnterWindow( wxMouseEvent& event );
65
66 void Render( void );
67 void InitGL(void);
68 void Rotate( GLfloat deg );
69 static GLfloat CalcRotateSpeed( unsigned long acceltime );
70 static GLfloat CalcRotateAngle( unsigned long lasttime,
71 unsigned long acceltime );
72 void Action( long code, unsigned long lasttime,
73 unsigned long acceltime );
74
75private:
76 bool m_init;
77 GLuint m_gllist;
78 long m_rleft;
79 long m_rright;
80
81 static unsigned long m_secbase;
82 static int m_TimeInitialized;
83 static unsigned long m_xsynct;
84 static unsigned long m_gsynct;
85
86 long m_Key;
87 unsigned long m_StartTime;
88 unsigned long m_LastTime;
89 unsigned long m_LastRedraw;
90
91DECLARE_EVENT_TABLE()
92};
93
94#endif
95
2db98bf5
JS
96#endif
97