/[usata]/usata2/src/scene-manager.cpp
ViewVC logotype

Diff of /usata2/src/scene-manager.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by skunix, Sun Jan 2 02:48:32 2005 UTC revision 1.5 by skunix, Sun Jan 2 06:01:19 2005 UTC
# Line 13  Line 13 
13  // $Id$  // $Id$
14    
15  #include "scene-manager.hpp"  #include "scene-manager.hpp"
16    #include <boost/bind.hpp>
17  #include <map>  #include <map>
 #include <boost/lambda/bind.hpp>  
 #include <boost/lambda/lambda.hpp>  
18  namespace  namespace
19  usata  usata
20  {  {
# Line 24  usata Line 23  usata
23  namespace SM_internal  namespace SM_internal
24  {  {
25    
 template <typename P>  
 struct FW : public std::unary_function<P,void>  
 {  
         void operator()(P t)  
         {  
                 t.second->draw();  
         }  
 };  
26  struct Impl  struct Impl
27  {  {
28    
# Line 44  struct Impl Line 35  struct Impl
35    
36          void draw()          void draw()
37          {          {
38                  using namespace ::boost::lambda;                  using boost::bind;
39                  std::for_each(children.begin(), children.end(),                  std::for_each(children.begin(), children.end(),
40                                  FW<ChildrenMap::value_type>());                                                  bind(&Object::draw, bind(&Object_sp::get,
41                                                            bind(&ChildrenMap::value_type::second, _1))));
42      }      }
43    
44    
45            void update()
46            {
47                    using std::for_each;
48                    using boost::bind;
49                    for_each(children.begin(), children.end(),
50                            bind(&Object::update,
51                                    bind(&Object_sp::get,
52                                            bind(&ChildrenMap::value_type::second,_1)
53                                    )
54                            ));
55    
56            }
57                                    
58          AddStatus add(const Object_sp& obj)          AddStatus add(const Object_sp& obj)
59          {          {
# Line 133  SceneManager::add_child(const Object_sp& Line 139  SceneManager::add_child(const Object_sp&
139                  return;                  return;
140          }                }      
141    
142          return child_interface->add_child(pObj, cpy);                    child_interface->add_child(pObj, cpy);
143            return;
144  }  }
145  Object_sp  Object_sp
146  SceneManager::get_child(const std::string& name)  SceneManager::get_child(const std::string& name)
# Line 145  SceneManager::get_child(const std::strin Line 152  SceneManager::get_child(const std::strin
152  void  void
153  SceneManager::draw()  SceneManager::draw()
154  {  {
155            impl->draw();
156            return;
157    }
158    
159    void
160    SceneManager::update()
161    {
162            impl->update();
163            return;
164  }  }
165    
166    

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26