+std::invocable
This commit is contained in:
parent
27cf20fac3
commit
f313d64d4a
1 changed files with 7 additions and 4 deletions
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <concepts>
|
||||
#include <functional>
|
||||
#include <vector>
|
||||
|
||||
|
@ -7,9 +8,9 @@ namespace zecsy
|
|||
class system_scheduler final
|
||||
{
|
||||
public:
|
||||
void add_system(float freq, auto&& func);
|
||||
void add_system(float freq, std::invocable<float> auto&& func);
|
||||
|
||||
void add_system(int freq, auto&& func);
|
||||
void add_system(int freq, std::invocable<float> auto&& func);
|
||||
|
||||
void update(float dt);
|
||||
|
||||
|
@ -24,13 +25,15 @@ namespace zecsy
|
|||
std::vector<system_handler> systems;
|
||||
};
|
||||
|
||||
inline void system_scheduler::add_system(float freq, auto&& func)
|
||||
inline void system_scheduler::add_system(float freq,
|
||||
std::invocable<float> auto&& func)
|
||||
{
|
||||
systems.emplace_back(1.0f / freq, 0.0f,
|
||||
std::forward<decltype(func)>(func));
|
||||
}
|
||||
|
||||
inline void system_scheduler::add_system(int freq, auto&& func)
|
||||
inline void system_scheduler::add_system(int freq,
|
||||
std::invocable<float> auto&& func)
|
||||
{
|
||||
add_system(float(freq), func);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue