Ei kuvausta
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 619B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef ENTITY_H
  2. #define ENTITY_H
  3. #include "olcPGEX_Graphics2D.h"
  4. #include "olcPixelGameEngine.h"
  5. #include <cmath>
  6. namespace pabloader {
  7. class Debuggers;
  8. class Entity {
  9. protected:
  10. Debuggers* game;
  11. olc::GFX2D::Transform2D transform;
  12. float x, y;
  13. float xv, yv;
  14. int w, h;
  15. public:
  16. Entity(Debuggers* game_);
  17. virtual ~Entity(){};
  18. virtual void Update(float dt) = 0;
  19. virtual void Draw() = 0;
  20. float GetX() { return x; }
  21. float GetY() { return y; }
  22. bool Collides(Entity* entity);
  23. float Dist(Entity* entity) { return std::hypot(x - entity->x, y - entity->y); }
  24. };
  25. }
  26. #endif