REBASE AWESOME

This commit is contained in:
2025-05-23 14:59:24 -04:00
parent b4e08ff28d
commit 593bbd6786
19 changed files with 468 additions and 459 deletions

View File

@@ -1,4 +1,5 @@
#pragma once
#include <memory>
#include <string>
#include <vector>
@@ -11,19 +12,27 @@ class Entity {
protected:
float x;
float y;
static inline size_t next_id = 0;
const size_t entity_id;
public:
Entity() : x(0.0f), y(0.0f) {}
Entity() : x(0.0f), y(0.0f), entity_id(++next_id) {}
Entity(float init_x, float init_y)
: x(init_x), y(init_y), entity_id(++next_id) {}
virtual ~Entity() = default;
float getX() const noexcept { return x; }
float getY() const noexcept { return y; }
size_t getId() const noexcept { return entity_id; }
virtual void update() noexcept = 0;
virtual bool isOffScreen() const noexcept = 0;
virtual const std::vector<std::string> &getImage() const = 0;
virtual const std::vector<std::string> &getMask() const = 0;
virtual char getDefaultColor() const noexcept = 0;
void draw(int layer) const;
virtual bool shouldBeRemoved() const noexcept = 0;
virtual std::unique_ptr<Entity> createReplacement() const = 0;
virtual int getPreferredLayer() const noexcept = 0;
void draw(int) const;
};