]> git.saurik.com Git - wxWidgets.git/blame - utils/glcanvas/samples/cube/cube.h
Tried to make wxGLCanvas work again. WIP.
[wxWidgets.git] / utils / glcanvas / samples / cube / cube.h
CommitLineData
6a1120ad
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
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_CUBE_H_
13#define _WX_CUBE_H_
14
15#include "glcanvas.h"
16
17// Define a new application type
18class MyApp: public wxApp
19{
20public:
21 bool OnInit(void);
6a1120ad
JS
22};
23
24// Define a new frame type
25class TestGLCanvas;
26class MyFrame: public wxFrame
c2265822
JS
27{
28public:
286cb97f
UN
29 MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos,
30 const wxSize& size, long style = wxDEFAULT_FRAME_STYLE);
6a1120ad
JS
31
32 void OnExit(wxCommandEvent& event);
089e55d6
RR
33 void OnNewWindow();
34 void OnDefRotateLeftKey();
35 void OnDefRotateRightKey();
36
c2265822 37public:
6a1120ad
JS
38 TestGLCanvas* m_canvas;
39
40DECLARE_EVENT_TABLE()
41};
42
43class TestGLCanvas: public wxGLCanvas
44{
286cb97f
UN
45 friend class MyFrame;
46public:
47 TestGLCanvas(wxWindow *parent, const wxWindowID id = -1,
48 const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
49 long style = 0, const wxString& name = "TestGLCanvas");
50 TestGLCanvas(wxWindow *parent, const TestGLCanvas &other,
089e55d6
RR
51 const wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
52 const wxSize& size = wxDefaultSize, long style = 0,
53 const wxString& name = "TestGLCanvas" );
54
286cb97f 55 ~TestGLCanvas(void);
6a1120ad 56
286cb97f
UN
57 void OnPaint(wxPaintEvent& event);
58 void OnSize(wxSizeEvent& event);
59 void OnEraseBackground(wxEraseEvent& event);
60 void OnKeyDown(wxKeyEvent& event);
61 void OnKeyUp(wxKeyEvent& event);
62 void OnEnterWindow( wxMouseEvent& event );
63
64 void Render( void );
65 void InitGL(void);
66 void Rotate( GLfloat deg );
67 static GLfloat CalcRotateSpeed( unsigned long acceltime );
68 static GLfloat CalcRotateAngle( unsigned long lasttime,
69 unsigned long acceltime );
70 void Action( long code, unsigned long lasttime,
71 unsigned long acceltime );
f6fcbb63 72
286cb97f
UN
73private:
74 bool m_init;
75 GLuint m_gllist;
76 long m_rleft;
77 long m_rright;
78
79 static unsigned long m_secbase;
80 static int m_TimeInitialized;
81 static unsigned long m_xsynct;
82 static unsigned long m_gsynct;
83
84 long m_Key;
85 unsigned long m_StartTime;
86 unsigned long m_LastTime;
87 unsigned long m_LastRedraw;
6a1120ad
JS
88
89DECLARE_EVENT_TABLE()
90};
91
92#endif
93