0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 07:53:43 +00:00
SDL_Minigame/src/Entity.cpp
2024-10-12 20:23:18 +02:00

51 lines
825 B
C++

#include "Entity.h"
#include "Manager.h"
#include "Component.h"
#include <cstddef>
void Entity::update() const
{
for (auto const& c : components){
std::cout << "whoop info: " << c->componentName() << std::endl;
c->update();
}
}
void Entity::draw() const
{
for (auto const& c : components) c->draw();
}
bool Entity::hasGroup(Group mGroup)
{
return groupBitSet[mGroup];
}
void Entity::addGroup(Group mGroup)
{
groupBitSet[mGroup] = true;
manager.addToGroup(this, mGroup);
}
void Entity::delGroup(Group mGroup)
{
groupBitSet[mGroup] = false;
}
std::bitset<MAX_GROUPS> Entity::getGroupBitSet()
{
return groupBitSet;
}
void Entity::setTeam(Entity::TeamLabel teamLabel)
{
this->teamLabel = teamLabel;
manager.addToTeam(this, (size_t) teamLabel);
}
Entity::TeamLabel Entity::getTeam()
{
return teamLabel;
}