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 |
{ |
{ |
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 |
|
|
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 |
{ |
{ |
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) |
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 |
|
|