Skip to content

Latest commit

 

History

History
72 lines (52 loc) · 1.24 KB

_engine_8hpp.md

File metadata and controls

72 lines (52 loc) · 1.24 KB
title
src/ecs/Engine.hpp

src/ecs/Engine.hpp

Namespaces

Name
ecs

Classes

Name
class ecs::Engine

Source code

/*
** EPITECH PROJECT, 2022
** RTYPE
** File description:
** Engine
*/

#pragma once

#include <filesystem>
#include <functional>
#include <memory>
#include "Engine.hpp"
#include "Registry.hpp"
#include "Window.hpp"
#include "World.hpp"
#include "WorldManager.hpp"

namespace ecs
{
    class Engine {
      public:
        explicit Engine()
        {
            ecs::WorldManager::setWorldSwitchReady(false);
            ecs::World initWorld;
            ecs::WorldManager::getInstance()._currentWorld = std::make_unique<ecs::World>(initWorld);
        }

        void run()
        {
            while (utils::Window::isOpen()) {
                ecs::WorldManager::getWorld().runSystems();
                if (ecs::WorldManager::isWorldSwitchReady())
                    ecs::WorldManager::switchWorlds();
            }
        }
    };
} // namespace ecs

Updated on 2022-11-13 at 17:21:37 +0100