ADD: Abstract Scenes, #closes 16
All checks were successful
Tests / test (push) Successful in 2m26s

This commit is contained in:
Sebastian Böckelmann 2026-04-21 14:20:04 +02:00
parent 0e2805ed06
commit 8ea01b7850
2 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,21 @@
//
// Created by sebastian on 21.04.26.
//
#include "Scene.h"
void Scene::onUpdate() {
for (const auto& layer : layers) {
layer->onUpdate();
}
}
void Scene::onRender() {
for (const auto& layer : layers) {
layer->onRender();
}
}
void Scene::addLayer(std::unique_ptr<Layer> layer) {
layers.push_back(std::move(layer));
}

View File

@ -0,0 +1,29 @@
//
// Created by sebastian on 21.04.26.
//
#ifndef SCENE_H
#define SCENE_H
#include <memory>
#include <vector>
#include "../../layer/Layer.h"
class Scene {
public:
virtual ~Scene() = default;
virtual void onEnter() {} //Layer registrieren
virtual void onExit() {} //Aufräumen, Daten unloaden
void onUpdate();
void onRender();
protected:
std::vector<std::unique_ptr<Layer>> layers;
void addLayer(std::unique_ptr<Layer> layer);
};
#endif //SCENE_H