Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
EntityToIDString.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <bit>
4#include <fmt/format.h>
5#include <string>
6
7namespace Log {
8template <typename T> inline T GetEntityIndex(const T &entity) { return entity & 0x000FFFFF; }
9
10template <typename T> inline T GetEntityVersion(const T &entity) { return entity >> 20; }
11
12template <typename T> inline std::string EntityToDebugString(const T &entity)
13{
14 return fmt::format("({}, {})", GetEntityIndex(entity), GetEntityVersion(entity));
15}
16} // namespace Log
Definition EntityToIDString.hpp:7
T GetEntityIndex(const T &entity)
Definition EntityToIDString.hpp:8
std::string EntityToDebugString(const T &entity)
Definition EntityToIDString.hpp:12
T GetEntityVersion(const T &entity)
Definition EntityToIDString.hpp:10