Make child entites work. z-sort entity list before rendering. entites have a creation timestamp.
22 lines
602 B
C++
22 lines
602 B
C++
#pragma once
|
|
|
|
#include <Engine/Entity/Entity.h>
|
|
#include <JGL/JGL.h>
|
|
|
|
namespace Engine {
|
|
class Renderable;
|
|
}
|
|
|
|
class Engine::Renderable : public Entity {
|
|
protected:
|
|
// Higher numbers are farther to the back.
|
|
unsigned int depth = 0;
|
|
public:
|
|
[[nodiscard]] unsigned int GetDepth() const { return depth; }
|
|
void SetDepth(unsigned int new_depth) { depth = new_depth; }
|
|
public:
|
|
// *must* be overridden.
|
|
virtual void Render() = 0;
|
|
public:
|
|
explicit Renderable(const Vector2& position, unsigned int depth = 0, float rotation = 0.0f) : Entity(position, rotation), depth(depth) {}
|
|
}; |