fork download
  1. //Binds an easing function that has multiple parameters to a function that takes just one float ('position') as a parameter.
  2. //Whatever function you are binding needs to start with 'position' as the first parameter.
  3. template<typename Function, typename... ExtraArgs>
  4. EaseFunction MakeEaseIn(Function &&easeFunction, ExtraArgs&&... extraArgs)
  5. {
  6. return std::bind(easeFunction, std::placeholders::_1, std::forward<ExtraArgs>(extraArgs)...);
  7. }
  8.  
  9. //Binds your EaseIn function for you, and returns an EaseOut function.
  10. template<class... ExtraArgs>
  11. EaseFunction MakeEaseOut(EaseFunction easeFunction, ExtraArgs&&... extraArgs)
  12. {
  13. return std::bind(DoEaseOut, std::bind(easeFunction, std::placeholders::_1, extraArgs...), std::placeholders::_1);
  14. }
  15.  
  16. //Binds your EaseIn function for you, and returns an EaseInOut function.
  17. template<class... ExtraArgs>
  18. EaseFunction MakeEaseInOut(EaseFunction easeFunction, ExtraArgs&&... extraArgs)
  19. {
  20. return std::bind(DoEaseInOut, std::bind(easeFunction, std::placeholders::_1, extraArgs...), std::placeholders::_1);
  21. }
  22.  
  23. //Binds your EaseIn function for you, and returns an EaseOutIn function.
  24. template<class... ExtraArgs>
  25. EaseFunction MakeEaseOutIn(EaseFunction easeFunction, ExtraArgs&&... extraArgs)
  26. {
  27. return std::bind(DoEaseOutIn, std::bind(easeFunction, std::placeholders::_1, extraArgs...), std::placeholders::_1);
  28. }
Not running #stdin #stdout 0s 0KB
stdin
Standard input is empty
stdout
Standard output is empty