This commit is contained in:
parent
0e2805ed06
commit
8ea01b7850
21
src/engine/core/scenes/Scene.cpp
Normal file
21
src/engine/core/scenes/Scene.cpp
Normal 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));
|
||||
}
|
||||
29
src/engine/core/scenes/Scene.h
Normal file
29
src/engine/core/scenes/Scene.h
Normal 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
|
||||
Loading…
Reference in New Issue
Block a user