Initial Commit
This commit is contained in:
7
include/Engine/Entity/Camera.h
Normal file
7
include/Engine/Entity/Camera.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "J3ML/LinearAlgebra/Vector2.hpp"
|
||||
#include "Entity.h"
|
||||
#pragma once
|
||||
|
||||
class Camera : public Entity {
|
||||
|
||||
};
|
37
include/Engine/Entity/Entity.h
Normal file
37
include/Engine/Entity/Entity.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
#include "J3ML/LinearAlgebra/Vector2.hpp"
|
||||
#include <vector>
|
||||
|
||||
class Entity {
|
||||
protected:
|
||||
std::vector<Entity*> children{};
|
||||
Vector2 position = {0, 0};
|
||||
// Assuming 0 radians is up.
|
||||
float face_angle = 0.0f;
|
||||
void UpdateChildren();
|
||||
public:
|
||||
// Movements independent of the rotation.
|
||||
void MoveX(float speed);
|
||||
void MoveY(float speed);
|
||||
|
||||
// Movements dependent on face angle.
|
||||
void MoveForward(float speed);
|
||||
void MoveBackward(float speed);
|
||||
void MoveLeft(float speed);
|
||||
void MoveRight(float speed);
|
||||
|
||||
void Rotate(float speed);
|
||||
void SetRotation(float new_rotation);
|
||||
|
||||
[[nodiscard]] bool AppendChild(Entity* entity);
|
||||
void DestroyChild(Entity* entity);
|
||||
void RemoveChild(Entity* entity);
|
||||
public:
|
||||
[[nodiscard]] float GetRotation() const;
|
||||
[[nodiscard]] Vector2 GetPosition() const;
|
||||
public:
|
||||
virtual void Update() {}
|
||||
public:
|
||||
explicit Entity(const Vector2& position, float rotation = 0.0f) : position(position), face_angle(rotation) {}
|
||||
virtual ~Entity();
|
||||
};
|
7
include/Engine/Entity/Hud.h
Normal file
7
include/Engine/Entity/Hud.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
#include "Renderable.h"
|
||||
|
||||
class Hud : public Renderable {
|
||||
public:
|
||||
Hud() : Renderable({0, 0}, 0) {};
|
||||
};
|
11
include/Engine/Entity/Renderable.h
Normal file
11
include/Engine/Entity/Renderable.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "Entity.h"
|
||||
#include "JGL/JGL.h"
|
||||
|
||||
class Renderable : public Entity {
|
||||
public:
|
||||
virtual void Render() {}
|
||||
public:
|
||||
explicit Renderable(const Vector2& position, float rotation = 0.0f) : Entity(position, rotation) {}
|
||||
};
|
Reference in New Issue
Block a user