Ignore:
Timestamp:
06/14/14 22:40:25 (11 years ago)
Author:
epyon
Message:
  • object can now only created from root
  • all registration is done root side
  • gui::element draw and update logic fully in environment
  • root removed from object - a lot less coupling
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/gui_element.cc

    r126 r257  
    77#include "nv/gui/gui_element.hh"
    88
    9 #include "nv/gui/gui_environment.hh"
    10 
    119using namespace nv;
    1210using namespace nv::gui;
    1311
    14 element::element( root* aroot, const rectangle& r )
    15         : object( aroot, "" ), m_class(""), m_relative( r ), m_absolute( r ), m_enabled( true ), m_visible( true ), m_dirty( true ), m_render_data( nullptr )
     12element::element( const rectangle& r )
     13        : object( "" ), m_class(""), m_relative( r ), m_absolute( r ), m_enabled( true ), m_visible( true ), m_dirty( true ), m_render_data( nullptr )
    1614{
    1715
    18 }
    19 
    20 void element::on_update( uint32 elapsed )
    21 {
    22         if ( is_visible() )
    23         {
    24                 for ( object* i : *this )
    25                 {
    26                         ((element*)i)->on_update( elapsed );
    27                 }
    28         }
    29         ((environment*)m_root)->update( this, elapsed );
    30 }
    31 
    32 void element::on_draw()
    33 {
    34         if ( is_visible() )
    35         {
    36                 ((environment*)m_root)->draw( this );
    37                 for ( object* i : *this )
    38                 {
    39                         ((element*)i)->on_draw();
    40                 }
    41         }
    4216}
    4317
Note: See TracChangeset for help on using the changeset viewer.