X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/bcc4c54184e715365e3b02b73131ac34e08fdb45..3682ea7d2cafc2cbb3f9093e0f864dfff54327dd:/samples/opengl/penguin/penguin.cpp diff --git a/samples/opengl/penguin/penguin.cpp b/samples/opengl/penguin/penguin.cpp index 0c68641835..b1e573bd9b 100644 --- a/samples/opengl/penguin/penguin.cpp +++ b/samples/opengl/penguin/penguin.cpp @@ -25,10 +25,6 @@ #include "wx/wx.h" #endif -#if !wxUSE_GLCANVAS -#error Please set wxUSE_GLCANVAS to 1 in setup.h. -#endif - #include "penguin.h" #ifdef __WXMAC__ # ifdef __DARWIN__ @@ -57,6 +53,7 @@ bool MyApp::OnInit() menuBar->Append(fileMenu, wxT("&File")); frame->SetMenuBar(menuBar); +#if wxUSE_GLCANVAS frame->SetCanvas( new TestGLCanvas(frame, -1, wxPoint(0, 0), wxSize(200, 200), wxSUNKEN_BORDER) ); /* Load file wiht mesh data */ @@ -66,6 +63,13 @@ bool MyApp::OnInit() frame->Show(TRUE); return TRUE; +#else + + wxMessageBox( _T("This sample has to be compiled with wxUSE_GLCANVAS"), _T("Building error"), wxOK); + + return FALSE; + +#endif } IMPLEMENT_APP(MyApp) @@ -79,15 +83,19 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, long style): wxFrame(frame, -1, title, pos, size, style) { +#if wxUSE_GLCANVAS m_canvas = NULL; +#endif } /* Intercept menu commands */ -void MyFrame::OnExit(wxCommandEvent& event) +void MyFrame::OnExit(wxCommandEvent& WXUNUSED(event)) { Destroy(); } +#if wxUSE_GLCANVAS + BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas) EVT_SIZE(TestGLCanvas::OnSize) EVT_PAINT(TestGLCanvas::OnPaint) @@ -108,7 +116,7 @@ TestGLCanvas::~TestGLCanvas(void) lw_object_free(info.lwobject); } -void TestGLCanvas::OnPaint( wxPaintEvent& event ) +void TestGLCanvas::OnPaint( wxPaintEvent& WXUNUSED(event) ) { /* must always be here */ wxPaintDC dc(this); @@ -170,7 +178,7 @@ void TestGLCanvas::OnSize(wxSizeEvent& event) } } -void TestGLCanvas::OnEraseBackground(wxEraseEvent& event) +void TestGLCanvas::OnEraseBackground(wxEraseEvent& WXUNUSED(event)) { /* Do nothing, to avoid flashing on MSW */ } @@ -249,3 +257,4 @@ void TestGLCanvas::InitGL(void) } +#endif