24#include <unordered_map>
99 explicit Name(
const std::string& name) :
value(name) {}
156 std::unordered_map<std::string, ScriptFieldValue>
values;
166 bool has(
const std::string& name)
const {
168 if (inst.componentName == name)
return true;
176 if (inst.componentName == name)
return &inst;
183 if (inst.componentName == name)
return &inst;
190 instances.push_back(std::move(instance));
197 [&name](
const ScriptInstance& inst) { return inst.componentName == name; }),
213 return hash<esengine::u64>{}(uuid.value);
Core type definitions and utilities for ESEngine.
std::variant< f32, i32, bool, std::string, glm::vec2, glm::vec3, glm::vec4, u32 > ScriptFieldValue
Value type for script component fields.
std::int32_t i32
Signed 32-bit integer.
std::uint64_t u64
Unsigned 64-bit integer.
std::uint32_t u32
Unsigned 32-bit integer.
float f32
32-bit floating point
Tag component marking an entity as active.
Tag component marking an entity as a folder for organization.
Tag component marking an entity as the main/primary entity.
Name(std::string &&name)
Constructs with name (move).
std::string value
The entity's name.
Name(const char *name)
Constructs with C-string.
Name(const std::string &name)
Constructs with name (copy).
Name()=default
Default constructor (empty name).
Instance of a script component attached to an entity.
std::unordered_map< std::string, ScriptFieldValue > values
std::string componentName
Component storing all script instances for an entity.
bool has(const std::string &name) const
Check if entity has a specific script component.
const ScriptInstance * get(const std::string &name) const
ScriptInstance * get(const std::string &name)
Get script instance by name (nullptr if not found).
std::vector< ScriptInstance > instances
void add(ScriptInstance &&instance)
Add a script instance.
void remove(const std::string &name)
Remove script instance by name.
Tag component marking an entity as static (non-moving).
Universally Unique Identifier component.
bool operator!=(const UUID &other) const
u64 value
The unique identifier.
bool operator==(const UUID &other) const
Tag component marking an entity as visible.
size_t operator()(const esengine::ecs::UUID &uuid) const noexcept