A 2D tile-based sandbox game.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Entity.h 472B

123456789101112131415161718192021222324252627282930
  1. #pragma once
  2. #include <memory>
  3. #include "common.h"
  4. namespace Swan {
  5. class World;
  6. class WorldPlane;
  7. class Entity {
  8. public:
  9. class Factory {
  10. public:
  11. virtual ~Factory() = default;
  12. virtual Entity *create(World &world, const Vec2 &pos) = 0;
  13. std::string name_;
  14. };
  15. virtual ~Entity() = default;
  16. virtual const Vec2 &getPos() { return Vec2::ZERO; }
  17. virtual void draw(Win &win) {}
  18. virtual void update(WorldPlane &plane, float dt) {}
  19. virtual void tick() {}
  20. };
  21. }