Onyx-Engine/src/core/Core.h

83 lines
1.4 KiB
C
Raw Normal View History

2025-05-18 17:42:48 +00:00
//
// Created by spenc on 5/14/2025.
//
#ifndef CORE_H
#define CORE_H
#include <utility>
#include <vector>
#include <memory>
#include "Layer.h"
#include "systems/Logger.h"
#include "systems/Profiler.h"
#include "systems/WindowManager.h"
2025-05-18 18:29:55 +00:00
#include "systems/MACROS.h"
2025-05-18 17:42:48 +00:00
#define OX_ENGINE_VERSION "Onyx Engine (2025.1)"
2025-05-18 17:42:48 +00:00
namespace OX
{
class Core
{
2025-05-18 17:42:48 +00:00
public:
Core(std::string name) : m_name(std::move(name))
{
};
2025-05-18 17:42:48 +00:00
~Core() = default;
void Init();
void Run();
2025-05-18 17:42:48 +00:00
void Shutdown();
2025-05-18 17:42:48 +00:00
WindowManager &GetWindow() { return window; }
2025-05-18 17:42:48 +00:00
void AddLayer(std::unique_ptr<Layer> layer);
private:
void Update();
2025-05-18 17:42:48 +00:00
void Draw();
std::vector<std::unique_ptr<Layer> > m_layers;
2025-05-18 17:42:48 +00:00
WindowManager window;
bool m_running = false;
std::string m_name = "Application";
};
class DummyLayer : public Layer
{
public:
explicit DummyLayer(const std::string &name = "Dummy Layer")
: Layer(name)
{
}
void Init(Core &core) override
{
Logger::LogInfo("DummyLayer '%s' initialized.", m_name.c_str());
}
void Update(Core &core) override
{
}
void Draw(Core &core) override
{
}
void Shutdown(Core &core) override
{
Logger::LogInfo("DummyLayer '%s' shutting down.", m_name.c_str());
}
};
2025-05-18 17:42:48 +00:00
}
#endif // CORE_H