Make child entites work. z-sort entity list before rendering. entites have a creation timestamp.
50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <vector>
|
|
#include <Engine/Entity/Renderable.h>
|
|
#include <Engine/Entity/Hud.h>
|
|
#include <Engine/Level/Fixed.h>
|
|
#include <JGL/types/RenderTarget.h>
|
|
|
|
namespace Engine {
|
|
class Camera;
|
|
class Scene;
|
|
}
|
|
|
|
class Engine::Scene {
|
|
protected:
|
|
std::string name;
|
|
Hud* heads_up_display = nullptr;
|
|
Camera* active_camera = nullptr;
|
|
std::vector<Fixed*> fixed_list{};
|
|
std::vector<Entity*> entity_list{};
|
|
protected:
|
|
[[nodiscard]] std::vector<Entity*> GetFlatEntityList(const std::vector<Entity*>& entity_list) const;
|
|
public:
|
|
[[nodiscard]] bool EntityListContains(const Entity* entity) const;
|
|
[[nodiscard]] bool FixedListContains(const Fixed* fixed) const;
|
|
[[nodiscard]] size_t FixedCount() const;
|
|
[[nodiscard]] size_t EntityCount() const;
|
|
[[nodiscard]] std::string GetName() const;
|
|
[[nodiscard]] Camera* GetActiveCamera() const;
|
|
public:
|
|
void AppendEntity(Entity* entity);
|
|
void AppendFixed(Fixed* fixed);
|
|
|
|
// Removes and deallocates.
|
|
void DestroyEntity(Entity* entity);
|
|
void DestroyFixed(Fixed* fixed);
|
|
|
|
// Only removes from the list.
|
|
void RemoveEntity(Entity* entity);
|
|
void RemoveFixed(Fixed* fixed);
|
|
|
|
virtual void Unload();
|
|
virtual void Init() {}
|
|
virtual void Update();
|
|
virtual void Render(RenderTarget* render_target = nullptr);
|
|
public:
|
|
explicit Scene(const std::string& name) : name(name) {}
|
|
virtual ~Scene();
|
|
};
|