1 #ifndef UGDK_SYSTEM_TASK_H_
2 #define UGDK_SYSTEM_TASK_H_
14 template<
typename Callable>
15 Task(Callable c,
double priotity = 0.5) : priority_(priotity) {
16 CallableAdapter<decltype(c(0.0))>::Set(function_, c);
25 return priority_ < other.priority_;
29 template<
typename Ret>
30 struct CallableAdapter {
31 template<
typename Callable>
32 static void Set(std::function<
bool (
double)>&
function, Callable c) {
38 std::function<bool (double)> function_;
42 struct Task::CallableAdapter<void> {
43 template<
typename Callable>
44 static void Set(std::function<
bool (
double)>&
function, Callable c) {
45 function = [c](
double dt) {
bool operator()(double dt)
Definition: task.h:21
~Task()
Definition: task.h:18
Definition: animation.h:11
Task(Callable c, double priotity=0.5)
Definition: task.h:15
bool operator<(const Task &other) const
Definition: task.h:24
static void Set(std::function< bool(double)> &function, Callable c)
Definition: task.h:44
double priority() const
Definition: task.h:20