10 static unsigned long m_tree_item_uid;
14 static unsigned long getuid(){
return ++m_tree_item_uid; }
18 template<
class __my
class>
37 : sibling_next(0) , sibling_prev(0) , child(0) , childnum(0) , parent(0) ,_child_destroy(
true),_my_destroy(
true)
40 m_uid = treeitem_uid::getuid();
49 const char* getIdentify()
55 void setIdentify(
const char* _ident )
58 size_t l = strlen(_ident);
61 for (
size_t i = 0 ; i < l ; i++ ) m_ident[i] = _ident[i];
67 void set_child_auto_destroy(
bool flag )
69 _child_destroy = flag;
72 void set_my_auto_destroy(
bool flag )
77 treeitem* get_parent(){
return parent;}
78 treeitem* get_child(){
return child;}
79 treeitem* get_sibling() {
return sibling_next;}
80 int get_childnum(){
return childnum; }
88 child->appendsibling(item);
96 if ( sibling_next == 0)
99 item->sibling_prev =
this;
101 sibling_next->appendsibling(item);
107 if ( item->_my_destroy ==
false ) return ;
109 if ( item->get_child() )
111 destroysub( item->child );
114 if ( item->get_sibling() )
116 destroysub( item->sibling_next );
117 item->sibling_next = 0;
125 if ( this->get_parent() )
127 get_parent()->prependtask(
this);
131 if ( _child_destroy )
143 sibling_next->sibling_prev = sibling_prev;
148 sibling_prev->sibling_next = sibling_next;
156 if ( root->sibling_next == sub )
158 root->sibling_next = sub->sibling_next;
159 if ( sub->sibling_next )
161 sub->sibling_next->sibling_prev = root;
165 if ( root->child == sub )
170 if ( temp->sibling_next )
172 temp->sibling_next->sibling_prev = 0;
173 temp->sibling_next->parent = root;
176 root->child = root->child->sibling_next;
180 if ( root->sibling_next )
182 prependsibling_sub( root->sibling_next , sub );
187 prependsibling_sub( root->child , sub );
197 prependsibling_sub(
this , item );
214 m_pause(
false),m_drawpause(
false)
218 void setpause(
bool sw ){ m_pause = sw; }
219 bool ispause(){
return m_pause;}
220 void setdrawpause(
bool sw ){ m_drawpause = sw;}
221 bool isdrawpause(){
return m_drawpause;}
224 virtual void draw(){};
226 virtual void update(
double delta){};
227 virtual void init(){};
243 void exec_resist_tasks_sub(
task_base* task ,
double delta_time);
244 void draw_resist_tasks_sub(
task_base* task );
254 void exec_resist_tasks(
double delta_time);
255 void draw_resist_tasks();
257 void destroy_tasks();
280 return task_manager_singleton::getinst();
286 get_rstaskmanager()->unresist_task( parent , reg_task);
290 return get_rstaskmanager()->get_root();
296 get_rstaskmanager()->resist_task( parent , reg_task);
298 get_rstaskmanager()->resist_task( task_getroot() , reg_task);
302 inline void task_manager_exec(
double delta_time)
304 get_rstaskmanager()->exec_resist_tasks(delta_time);
307 inline void task_manager_draw()
309 get_rstaskmanager()->draw_resist_tasks();
312 inline void task_manager_destroy()
314 if ( task_manager_singleton::getinst() )
316 delete task_manager_singleton::getinst();