Use std::invocable<T&...>
This commit is contained in:
parent
006d9fc95e
commit
3aaa4557c6
2 changed files with 12 additions and 11 deletions
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <concepts>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <format>
|
#include <format>
|
||||||
|
@ -8,9 +9,7 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <variant>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <concepts>
|
|
||||||
|
|
||||||
namespace zecsy
|
namespace zecsy
|
||||||
{
|
{
|
||||||
|
@ -213,6 +212,7 @@ namespace zecsy
|
||||||
void add_system(int freq, auto&& func);
|
void add_system(int freq, auto&& func);
|
||||||
|
|
||||||
void update(float dt);
|
void update(float dt);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct system_handler
|
struct system_handler
|
||||||
{
|
{
|
||||||
|
@ -273,7 +273,8 @@ namespace zecsy
|
||||||
void remove(entity_id e);
|
void remove(entity_id e);
|
||||||
|
|
||||||
template<Component... T>
|
template<Component... T>
|
||||||
void query(auto&& system);
|
void query(std::invocable<T&...> auto&& system);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
entities_set alive_entities;
|
entities_set alive_entities;
|
||||||
entity_id entity_counter = 0;
|
entity_id entity_counter = 0;
|
||||||
|
@ -328,7 +329,7 @@ namespace zecsy
|
||||||
}
|
}
|
||||||
|
|
||||||
template<Component... T>
|
template<Component... T>
|
||||||
inline void world::query(auto&& system)
|
inline void world::query(std::invocable<T&...> auto&& system)
|
||||||
{
|
{
|
||||||
for(auto e: alive_entities)
|
for(auto e: alive_entities)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue