- Timestamp:
- 06/17/13 22:20:08 (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/gui/gui_element.hh
r110 r126 197 197 protected: 198 198 friend class environment; 199 friend class renderer; 199 200 200 201 string m_class; ///< Class name. -
trunk/nv/gui/gui_environment.hh
r76 r126 15 15 16 16 #include <nv/gui/gui_element.hh> 17 #include <nv/gui/gui_style.hh> 18 #include <nv/lua/lua_state.hh> 19 #include <nv/interface/window.hh> 17 20 #include <nv/root.hh> 18 21 … … 22 25 namespace gui 23 26 { 27 class screen : public element 28 { 29 public: 30 screen( root* aroot, const rectangle& r ) : element( aroot, r ) {} 31 virtual bool on_event( const io_event& ) { return false; } 32 virtual void recalculate_absolute() { recalculate_absolute_children(); } 33 }; 24 34 25 35 class environment : public root 26 36 { 27 37 public: 38 environment( window* w ); 39 // temporary 40 void load_style( const std::string& filename ); 41 void update( element* e, uint32 elapsed ); 28 42 void draw( element* e ); 43 void update(); 44 void draw(); 45 virtual void add_child( object* child ); 46 virtual ~environment(); 47 protected: 48 renderer* m_renderer; 49 window* m_window; 50 screen* m_screen; 51 rectangle m_area; 29 52 }; 30 53 -
trunk/src/gui/gui_element.cc
r120 r126 27 27 } 28 28 } 29 //((environment*)m_root)->update( this, elapsed );29 ((environment*)m_root)->update( this, elapsed ); 30 30 } 31 31 -
trunk/src/gui/gui_environment.cc
r69 r126 7 7 #include "nv/gui/gui_environment.hh" 8 8 9 #include "nv/gui/gui_renderer.hh" 10 11 12 /* 13 14 TODO: parse a lua stylesheet as per Trac wiki 15 16 IDEA: Store everything in std::unordered_maps, with lua_value's? 17 18 A lua_value is a variant stores strings as const char* that deletes them on destructor? 19 Question is that there might not be much gained on speed anyway, due to Lua's speed. 20 Special function field allows delayed per parse execution? 21 22 */ 23 24 #include "nv/interface/mesh.hh" 25 #include "nv/gfx/cached_buffer.hh" 26 #include "nv/gfx/texture_atlas.hh" 27 28 #include <vector> 29 9 30 using namespace nv; 10 31 using namespace nv::gui; 11 32 33 environment::environment( window* w ) 34 : m_renderer( nullptr ), m_window( w ), m_screen( nullptr ) 35 { 36 m_area.dim( dimension( w->get_width(), w->get_height() ) ); 37 m_screen = new screen( this, m_area ); 38 m_renderer = new renderer( w ); 39 root::add_child( m_screen ); 40 } 41 42 void nv::gui::environment::load_style( const std::string& filename ) 43 { 44 m_renderer->load_style( filename ); 45 } 46 47 void environment::update( element* e, uint32 elapsed ) 48 { 49 if ( e->is_dirty() || e->m_render_data == nullptr ) 50 { 51 m_renderer->redraw( e, elapsed ); 52 e->set_dirty( false ); 53 } 54 } 55 12 56 void environment::draw( element* e ) 13 57 { 14 58 m_renderer->draw( e ); 15 59 } 60 61 void environment::update() 62 { 63 m_screen->on_update( 0 ); 64 } 65 66 void environment::draw() 67 { 68 m_screen->on_draw(); 69 m_renderer->draw(); 70 } 71 72 void environment::add_child( object* child ) 73 { 74 // TODO: check if element 75 m_screen->add_child( child ); 76 } 77 78 environment::~environment() 79 { 80 destroy_children(); 81 delete m_renderer; 82 } 83 -
trunk/src/io/c_file_system.cc
r124 r126 32 32 stream* c_file_system::open( const char* fpath, const char* fmode /*= "rb" */ ) 33 33 { 34 NV_ASSERT( fpath != nullptr && fpath != "" && fmode != nullptr );34 NV_ASSERT( fpath != nullptr && fpath != "" && fmode != nullptr, "Bad parameters passed to open" ); 35 35 FILE* file = ::fopen( fpath, fmode ); 36 36 if ( !file )
Note: See TracChangeset
for help on using the changeset viewer.