36 lines
768 B
C++
36 lines
768 B
C++
#pragma once
|
|
|
|
#include "Components.hpp"
|
|
#include "Entity.hpp"
|
|
|
|
class SceneManager;
|
|
|
|
/**
|
|
* Base state interface for scene manager states.
|
|
*/
|
|
class Scene {
|
|
public:
|
|
std::vector<std::shared_ptr<Entity>> entities;
|
|
explicit Scene(SceneManager &owner) : manager(owner) {}
|
|
virtual ~Scene() = default;
|
|
|
|
virtual void Enter() {}
|
|
virtual void Exit() {}
|
|
virtual void Update(float dt) = 0;
|
|
virtual void Draw() {
|
|
for (auto &entity : entities) {
|
|
if (!entity || entity->queuedForFree) {
|
|
continue;
|
|
}
|
|
|
|
auto render = entity->GetComponent<RenderComponent>();
|
|
if (render) {
|
|
render->get().Draw();
|
|
}
|
|
}
|
|
}
|
|
|
|
protected:
|
|
SceneManager &manager;
|
|
};
|