X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5cf036d017b19e9447e52e271c4afac2109ffcd3..6ce8b8484654b5ab073951373c93d9bdd8221881:/samples/opengl/penguin/penguin.cpp?ds=inline diff --git a/samples/opengl/penguin/penguin.cpp b/samples/opengl/penguin/penguin.cpp index 21e8b28c25..93634a4060 100644 --- a/samples/opengl/penguin/penguin.cpp +++ b/samples/opengl/penguin/penguin.cpp @@ -9,11 +9,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ -#pragma implementation -#pragma interface -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -25,6 +20,10 @@ #include "wx/wx.h" #endif +#if !wxUSE_GLCANVAS + #error "OpenGL required: set wxUSE_GLCANVAS to 1 and rebuild the library" +#endif + #include "penguin.h" #ifdef __WXMAC__ # ifdef __DARWIN__ @@ -36,14 +35,15 @@ # include #endif +#include "../../sample.xpm" + #define VIEW_ASPECT 1.3 // `Main program' equivalent, creating windows and returning main app frame bool MyApp::OnInit() { - // Create the main frame window - MyFrame *frame = new MyFrame(NULL, wxT("wxWindows OpenGL Penguin Sample"), + MyFrame *frame = new MyFrame(NULL, wxT("wxWidgets OpenGL Penguin Sample"), wxDefaultPosition, wxDefaultSize); /* Make a menubar */ @@ -54,7 +54,6 @@ bool MyApp::OnInit() menuBar->Append(fileMenu, wxT("&File")); frame->SetMenuBar(menuBar); -#if wxUSE_GLCANVAS frame->SetCanvas( new TestGLCanvas(frame, wxID_ANY, wxDefaultPosition, wxSize(200, 200), wxSUNKEN_BORDER) ); @@ -65,14 +64,6 @@ 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) @@ -86,9 +77,8 @@ MyFrame::MyFrame(wxFrame *frame, const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxFrame(frame, wxID_ANY, title, pos, size, style) { -#if wxUSE_GLCANVAS m_canvas = NULL; -#endif + SetIcon(wxIcon(sample_xpm)); } /* Intercept menu commands */ @@ -98,8 +88,6 @@ void MyFrame::OnExit( wxCommandEvent& WXUNUSED(event) ) Close(true); } -#if wxUSE_GLCANVAS - BEGIN_EVENT_TABLE(TestGLCanvas, wxGLCanvas) EVT_SIZE(TestGLCanvas::OnSize) EVT_PAINT(TestGLCanvas::OnPaint) @@ -109,7 +97,7 @@ END_EVENT_TABLE() TestGLCanvas::TestGLCanvas(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) - : wxGLCanvas(parent, id, pos, size, style, name) + : wxGLCanvas(parent, id, pos, size, style|wxFULL_REPAINT_ON_RESIZE, name) { block = false; } @@ -267,5 +255,3 @@ void TestGLCanvas::InitGL() glEnable(GL_COLOR_MATERIAL); } - -#endif // #if wxUSE_GLCANVAS