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 672B

12345678910111213141516171819202122232425262728293031323334
  1. #pragma once
  2. #include <memory>
  3. #include "common.h"
  4. #include "SRF.h"
  5. namespace Swan {
  6. class World;
  7. class WorldPlane;
  8. class Game;
  9. class Entity {
  10. public:
  11. class Factory {
  12. public:
  13. virtual ~Factory() = default;
  14. virtual Entity *create(const Context &ctx, const SRF &params) = 0;
  15. std::string name_;
  16. };
  17. virtual ~Entity() = default;
  18. virtual const Vec2 &getPos() { return Vec2::ZERO; }
  19. virtual void draw(const Context &ctx, Win &win) {}
  20. virtual void update(const Context &ctx, float dt) {}
  21. virtual void tick() {}
  22. virtual void readSRF(const Swan::Context &ctx, const SRF &srf) {}
  23. virtual SRF *writeSRF(const Swan::Context &ctx) { return new SRFNone(); }
  24. };
  25. }