Files
Re3D/include/types/entity.h
2024-01-03 09:26:21 -05:00

51 lines
1.3 KiB
C++

#pragma once
#include <cstdint>
#include <types/vector.h>
#include <J3ML/LinearAlgebra/Matrix4x4.h>
#include <J3ML/LinearAlgebra/Vector3.h>
class Entity {
protected:
LinearAlgebra::Matrix4x4 coordinates;
public:
Position position; //X Y Z
uint32_t ticksAlive; //At 64tps it'd take 776 days to overflow.
LinearAlgebra::Vector3 GetPos() const;
void SetPos(const LinearAlgebra::Vector3& rhs);
LinearAlgebra::Matrix4x4 GetMatrix() const;
void SetMatrix(const LinearAlgebra::Matrix4x4& rhs);
//Angle GetRotation() const { return glm::eulerAngles(); }
//void SetRotation(Angle&const rhs);
bool draw = true;
bool collidable = true;
void destruct() {
//TODO: Search entity list for this entity and remove it to avoid use-after-free.
// Non. This should be the concern of the object managing entities. Entity.h should JUST provide entity behavior.
}
virtual void pre_render() {}
virtual void post_render() {}
virtual void render() {}
virtual void update(float elapsed) {}
virtual void ticc(int tics)
{
ticksAlive++;
}
Entity() :
position(0,0,0),
ticksAlive(0)
{
}
Entity(const Entity& rhs) = default; // Boilerplate: Copy Constructor
Entity(Entity&& rhs) = default; // Boilerplate: Move Constructor
~Entity() = default;
};