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

void emptycontroller (Entity &e, float deltatime) {
  std::cout << "doing no shit cuz funny lmao";
}

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

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

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