Make child entites work. z-sort entity list before rendering. entites have a creation timestamp.
30 lines
988 B
C++
30 lines
988 B
C++
#pragma once
|
|
|
|
#include <Engine/Entity/Renderable.h>
|
|
#include <JGL/types/Texture.h>
|
|
#include <J3ML/Geometry/AABB2D.hpp>
|
|
|
|
namespace Engine {
|
|
class Sprite;
|
|
}
|
|
|
|
class Engine::Sprite : public Renderable {
|
|
protected:
|
|
Texture* texture = nullptr;
|
|
// Positive alpha mask.
|
|
Texture* alpha_mask = nullptr;
|
|
Vector2 scale = {1, 1};
|
|
// Local space, Where the face_angle rotation should be preformed about.
|
|
Vector2 origin = {0, 0};
|
|
Color4 base_color = Colors::White;
|
|
public:
|
|
[[nodiscard]] Texture* GetTexture();
|
|
// World space.
|
|
[[nodiscard]] virtual AABB2D GetBounds();
|
|
public:
|
|
void Render() override;
|
|
public:
|
|
~Sprite() override;
|
|
explicit Sprite(const Vector2& pos, unsigned int depth = 0, const float face_angle = 0.0f, const Color4& base_color = Colors::White, Texture* texture = nullptr,
|
|
Texture* alpha_mask = nullptr) : Renderable(pos, depth,face_angle), texture(texture), alpha_mask(alpha_mask), base_color(base_color) {}
|
|
}; |