Gaia-ECS v0.9.3
A simple and powerful entity component system
Loading...
Searching...
No Matches
component_getter.h
1#pragma once
2#include "gaia/config/config.h"
3
4#include <cstdint>
5
6#include "gaia/ecs/chunk.h"
7#include "gaia/ecs/component.h"
8
9namespace gaia {
10 namespace ecs {
12 const Chunk* m_pChunk;
13 uint16_t m_row;
14
18 template <typename T>
19 GAIA_NODISCARD decltype(auto) get() const {
20 verify_comp<T>();
21
22 if constexpr (entity_kind_v<T> == EntityKind::EK_Gen)
23 return m_pChunk->template get<T>(m_row);
24 else
25 return m_pChunk->template get<T>();
26 }
27 };
28 } // namespace ecs
29} // namespace gaia
Definition chunk.h:29
Checks if endianess was detected correctly at compile-time.
Definition bitset.h:9
Definition component_getter.h:11
GAIA_NODISCARD decltype(auto) get() const
Returns the value stored in the component T on entity.
Definition component_getter.h:19