mirror of
https://github.com/bailwillharr/engine.git
synced 2024-09-21 04:51:18 +00:00
Change something??
This commit is contained in:
parent
4f8252476c
commit
119978774c
@ -108,6 +108,14 @@ class Scene {
|
||||
ecs_systems_.emplace_back(hash, std::make_unique<T>(this));
|
||||
}
|
||||
|
||||
/* Pushes old systems starting at 'index' along by 1 */
|
||||
template <typename T>
|
||||
void RegisterSystemAtIndex(size_t index)
|
||||
{
|
||||
size_t hash = typeid(T).hash_code();
|
||||
ecs_systems_.emplace(ecs_systems_.begin() + index, hash, std::make_unique<T>(this));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
T* GetSystem()
|
||||
{
|
||||
|
@ -26,11 +26,11 @@ Scene::Scene(Application* app) : app_(app) {
|
||||
RegisterComponent<UIRenderableComponent>();
|
||||
|
||||
// Order here matters:
|
||||
RegisterSystem<CustomBehaviourSystem>(); // potentially modifies transforms
|
||||
RegisterSystem<TransformSystem>();
|
||||
RegisterSystem<CollisionSystem>();
|
||||
RegisterSystem<CustomBehaviourSystem>();
|
||||
RegisterSystem<MeshRenderSystem>();
|
||||
RegisterSystem<UIRenderSystem>();
|
||||
RegisterSystem<CollisionSystem>(); // depends on transformed world matrix
|
||||
RegisterSystem<MeshRenderSystem>(); // depends on transformed world matrix
|
||||
RegisterSystem<UIRenderSystem>(); // does nothing as of now
|
||||
}
|
||||
|
||||
Scene::~Scene() {}
|
||||
|
@ -68,7 +68,7 @@ void PlayGame(GameSettings settings)
|
||||
//engine::Entity temple = engine::util::LoadGLTF(*start_scene, "C:/games/temple.glb", true);
|
||||
|
||||
start_scene->RegisterComponent<CameraControllerComponent>();
|
||||
start_scene->RegisterSystem<CameraControllerSystem>();
|
||||
start_scene->RegisterSystemAtIndex<CameraControllerSystem>(0);
|
||||
start_scene->AddComponent<CameraControllerComponent>(camera)->noclip = true;
|
||||
start_scene->GetPosition(camera).z += 10.0f;
|
||||
}
|
||||
@ -93,7 +93,7 @@ void PlayGame(GameSettings settings)
|
||||
camera_transform->is_static = false;
|
||||
|
||||
main_scene->RegisterComponent<CameraControllerComponent>();
|
||||
main_scene->RegisterSystem<CameraControllerSystem>();
|
||||
main_scene->RegisterSystemAtIndex<CameraControllerSystem>(0);
|
||||
main_scene->AddComponent<CameraControllerComponent>(camera);
|
||||
|
||||
/* floor */
|
||||
|
Loading…
Reference in New Issue
Block a user