#include "entitybase.hpp"
#include "../../include/raylib-cpp.hpp"
#include "../render/textures.hpp"
#include <functional>
#include <sys/types.h>
#include <iostream>

Entity::Entity(ID Id, raylib::Rectangle Rect, std::string &n, int h, int maxh) {
  id = Id;
  rect = Rect;
  health = h;
  maxhealth = maxh;
  nametag = n;
}

void Entity::Update() {
  if (controller) {
    controller(*this);
  }else {
    std::cout << "Entity is missing an controller, doing nothing.\n";
  }
}

void Entity::Draw() {
  DrawTextureEx(entityTextures.GetTexture(id), raylib::Vector2(rect.x, rect.y), 0, 0, WHITE);
}
