Ignore:
Timestamp:
07/12/16 20:22:23 (9 years ago)
Author:
epyon
Message:
  • several STL updates
  • several minor fixes
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wx/wx_canvas.cc

    r470 r505  
    1313wxEND_EVENT_TABLE()
    1414
    15 nv::wx_gl_canvas::wx_gl_canvas( wxWindow *parent )
     15nv::wx_gl_canvas::wx_gl_canvas( wxWindow *parent, input* in )
    1616        : wxWindow( parent, wxID_ANY, wxDefaultPosition, wxDefaultSize,
    1717        wxFULL_REPAINT_ON_RESIZE )
     
    1919        nv::load_gl_no_context();
    2020        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
     30nv::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 );
    2135        m_render = true;
    22         m_wm = new nv::sdl::window_manager;
     36        m_wm = sibling->m_wm;
    2337        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() );
    2540        m_context = m_window->get_context();
     41        make_current();
     42        m_main = false;
     43
    2644}
    2745
    2846nv::wx_gl_canvas::~wx_gl_canvas()
    2947{
     48        make_current();
    3049        delete m_window;
    3150        delete m_device;
     
    3453void nv::wx_gl_canvas::on_paint( wxPaintEvent& )
    3554{
     55        make_current();
    3656        const wxSize client_size = GetClientSize();
    3757        m_context->set_viewport( nv::ivec4( nv::ivec2(), client_size.x, client_size.y ) );
     
    5373void nv::wx_gl_canvas::on_idle( wxIdleEvent& evt )
    5474{
    55         nv::sleep( 10 );
     75        nv::sleep( 1 );
    5676        if ( m_render )
    5777        {
     78                make_current();
    5879                on_update();
    5980                evt.RequestMore(); // render continuously, not only once on idle
    6081        }
     82}
     83
     84void nv::wx_gl_canvas::make_current()
     85{
     86        m_window->make_current();
    6187}
    6288
Note: See TracChangeset for help on using the changeset viewer.