UGDK
|
00001 #ifndef UGDK_ACTION_GENERICTASK_H_ 00002 #define UGDK_ACTION_GENERICTASK_H_ 00003 00004 #include <ugdk/portable/tr1.h> 00005 #include FROM_TR1(functional) 00006 #include <ugdk/action/task.h> 00007 00008 namespace ugdk { 00009 00010 namespace action { 00011 00012 class GenericTask : public Task { 00013 typedef Task super; 00014 protected: 00015 std::tr1::function<bool (double)> function_; 00016 public: 00017 GenericTask(std::tr1::function<bool (double)> func) : function_(func) {} 00018 00019 GenericTask(std::tr1::function<bool (double)> func, int priority) 00020 : Task(priority), function_(func) {} 00021 00022 void operator()(double dt) { 00023 finished_ = !function_(dt); 00024 } 00025 }; 00026 00027 } /* namespace action */ 00028 00029 } /* namespace ugdk */ 00030 00031 #endif /* UGDK_ACTION_GENERICTASK_H_ */