Did a bit of provider cleanup

This commit is contained in:
2023-03-10 09:59:47 -08:00
parent 93ff957e38
commit 95d1ef476f
3 changed files with 24 additions and 4 deletions

View File

@ -77,6 +77,16 @@ namespace Dawn {
return context->getGame()->timeManager.timeoutProvider.addEffect(someCallback, timeout, context);
}
/**
* Use interval provider method. Invokes your callback at a consistant and
* common time based on the interval you provide.
*
* @tparam T Your context type (usually SceneItemComponent).
* @param someCallback Callback to be invoked.
* @param timeout Interval to invoke your callback.
* @param context Context of the component, just use (this).
* @return Method that when invoked will unsubscribe from the interval.
*/
template<class T>
std::function<void()> useInterval(
std::function<void()> callback,