Changeset 505 for trunk/src/wx/wx_canvas.cc
- Timestamp:
- 07/12/16 20:22:23 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wx/wx_canvas.cc
r470 r505 13 13 wxEND_EVENT_TABLE() 14 14 15 nv::wx_gl_canvas::wx_gl_canvas( wxWindow *parent )15 nv::wx_gl_canvas::wx_gl_canvas( wxWindow *parent, input* in ) 16 16 : wxWindow( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, 17 17 wxFULL_REPAINT_ON_RESIZE ) … … 19 19 nv::load_gl_no_context(); 20 20 wxClientDC dc( this ); 21 m_render = true; 22 m_wm = new nv::sdl::window_manager; 23 m_device = new nv::gl_device(); 24 if ( !in ) in = new nv::sdl::input; 25 m_window = new nv::gl_window( m_device, m_wm, in, GetHWND(), dc.GetHDC() ); 26 m_context = m_window->get_context(); 27 m_main = true; 28 } 29 30 nv::wx_gl_canvas::wx_gl_canvas( wxWindow *parent, wx_gl_canvas *sibling, input* in ) 31 : wxWindow( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, 32 wxFULL_REPAINT_ON_RESIZE ) 33 { 34 wxClientDC dc( this ); 21 35 m_render = true; 22 m_wm = new nv::sdl::window_manager;36 m_wm = sibling->m_wm; 23 37 m_device = new nv::gl_device(); 24 m_window = new nv::gl_window( m_device, m_wm, new nv::sdl::input(), GetHWND(), dc.GetHDC() ); 38 if ( !in ) in = new nv::sdl::input; 39 m_window = new nv::gl_window( m_device, m_wm, in, GetHWND(), dc.GetHDC() ); 25 40 m_context = m_window->get_context(); 41 make_current(); 42 m_main = false; 43 26 44 } 27 45 28 46 nv::wx_gl_canvas::~wx_gl_canvas() 29 47 { 48 make_current(); 30 49 delete m_window; 31 50 delete m_device; … … 34 53 void nv::wx_gl_canvas::on_paint( wxPaintEvent& ) 35 54 { 55 make_current(); 36 56 const wxSize client_size = GetClientSize(); 37 57 m_context->set_viewport( nv::ivec4( nv::ivec2(), client_size.x, client_size.y ) ); … … 53 73 void nv::wx_gl_canvas::on_idle( wxIdleEvent& evt ) 54 74 { 55 nv::sleep( 1 0);75 nv::sleep( 1 ); 56 76 if ( m_render ) 57 77 { 78 make_current(); 58 79 on_update(); 59 80 evt.RequestMore(); // render continuously, not only once on idle 60 81 } 82 } 83 84 void nv::wx_gl_canvas::make_current() 85 { 86 m_window->make_current(); 61 87 } 62 88
Note: See TracChangeset
for help on using the changeset viewer.