language: C++ 4.7.2 (gcc-4.7.2)
date: 79 days 0 hours ago
link:
visibility: public
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//Binds an easing function that has multiple parameters to a function that takes just one float ('position') as a parameter.
//Whatever function you are binding needs to start with 'position' as the first parameter.
template<typename Function, typename... ExtraArgs>
EaseFunction MakeEaseIn(Function &&easeFunction, ExtraArgs&&... extraArgs)
{
    return std::bind(easeFunction, std::placeholders::_1, std::forward<ExtraArgs>(extraArgs)...);
}
 
//Binds your EaseIn function for you, and returns an EaseOut function.
template<class... ExtraArgs>
EaseFunction MakeEaseOut(EaseFunction easeFunction, ExtraArgs&&... extraArgs)
{
    return std::bind(DoEaseOut, std::bind(easeFunction, std::placeholders::_1, extraArgs...), std::placeholders::_1);
}
 
//Binds your EaseIn function for you, and returns an EaseInOut function.
template<class... ExtraArgs>
EaseFunction MakeEaseInOut(EaseFunction easeFunction, ExtraArgs&&... extraArgs)
{
    return std::bind(DoEaseInOut, std::bind(easeFunction, std::placeholders::_1, extraArgs...), std::placeholders::_1);
}
 
//Binds your EaseIn function for you, and returns an EaseOutIn function.
template<class... ExtraArgs>
EaseFunction MakeEaseOutIn(EaseFunction easeFunction, ExtraArgs&&... extraArgs)
{
    return std::bind(DoEaseOutIn, std::bind(easeFunction, std::placeholders::_1, extraArgs...), std::placeholders::_1);
}
C++11 templates for binding variable-argument easing functions to a consistent std::function format.