Initial Commit

This commit is contained in:
2025-01-02 00:15:37 -05:00
commit b9afc57e6e
29 changed files with 1826 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
#include "J3ML/LinearAlgebra/Vector2.hpp"
#include "Entity.h"
#pragma once
class Camera : public Entity {
};

View 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();
};

View File

@@ -0,0 +1,7 @@
#pragma once
#include "Renderable.h"
class Hud : public Renderable {
public:
Hud() : Renderable({0, 0}, 0) {};
};

View 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) {}
};