SDEngine
Game Engine
Loading...
Searching...
No Matches
Command.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <functional>
4#include <unordered_map>
5#include <vector>
6
7#include "EntityManager.hpp"
8#include "SD/core/type_id.hpp"
9#include "SD/core/types.hpp"
11
12namespace sd {
13
14struct CommandQueue;
15
18
19 [[nodiscard]] bool is_valid() const { return id != 0; }
20
21 bool operator==(const EntityHandle& other) const { return id == other.id; }
22 bool operator!=(const EntityHandle& other) const { return !(*this == other); }
23};
24
27 void* data;
28
30 void (*serialize_fn)(void* data, Serializer& s);
31 void (*deserialize_fn)(void* data, Serializer& s);
32};
33
34} // namespace sd
35
36template<>
37struct std::hash<sd::EntityHandle> {
38 inline std::size_t operator()(sd::EntityHandle h) const noexcept {
39 return std::hash<U32>{}(h.id);
40 }
41};
Definition Application.hpp:22
Definition Command.hpp:25
void(* deserialize_fn)(void *data, Serializer &s)
Definition Command.hpp:31
U64 type_id
Definition Command.hpp:26
void(* execute_fn)(void *data, EntityManager< ComponentGroup<> > &em, CommandQueue &queue)
Definition Command.hpp:29
void(* serialize_fn)(void *data, Serializer &s)
Definition Command.hpp:30
void * data
Definition Command.hpp:27
Definition CommandQueue.hpp:19
Definition Command.hpp:16
U32 id
Definition Command.hpp:17
bool operator==(const EntityHandle &other) const
Definition Command.hpp:21
bool operator!=(const EntityHandle &other) const
Definition Command.hpp:22
bool is_valid() const
Definition Command.hpp:19
Definition EntityManager.hpp:64
Definition serialization.hpp:38
std::size_t operator()(sd::EntityHandle h) const noexcept
Definition Command.hpp:38
std::uint32_t U32
Definition types.hpp:15
std::uint64_t U64
Definition types.hpp:16