3#include "editor/camera/Camera.h"
4#include "common/types/Types.h"
5#include "common/types/SmartPointers.h"
6#include "core/ecs/Entity.h"
7#include "core/ecs/Component.h"
21 extern Map<int, Ref<Component>> g_Components;
22 extern Map<int, Ref<Entity>> g_Entities;
23 extern int s_EntityID;
24 extern int s_ComponentID;
26 bool AddComponent(
int componentID,
int entityID);
27 bool RemoveComponent(
int componentID,
int entityID);
38 Ref<Component> GetComponent(ComponentType ct,
int entityID);
50 void GetAllComponents(
const ComponentType ct, Vector<T*>& components)
52 components.reserve(g_Components.size());
53 for (
auto& component : g_Components)
55 if (component.second->GetComponentType() == ct)
57 components.emplace_back(
static_cast<T*
>(component.second.get()));
67 Ref<Entity> CreateEntity(
const String& name);
76 typename std::enable_if<std::is_base_of<Component, T>::value, Ref<T>>::type CreateComponent()
78 Ref<T> component = MakeRef<T>();
79 g_Components[component->GetComponentID()] = component;
A class that represents the camera.
Contains functions to create and manage entities and components.