REBASE AWESOME
This commit is contained in:
15
src/Entity.h
15
src/Entity.h
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user