Entity update + components

This commit is contained in:
2026-03-24 09:00:23 +01:00
parent 0c0e7c41af
commit 8f2a4e9ecb
11 changed files with 197 additions and 7 deletions

View File

@@ -39,7 +39,7 @@ namespace Game::Object {
}
void Entity::render(Game::Renderer::Renderer* renderer, Game::Renderer::RendererConfig config) {
if (!mIsActive || !mTex) return; // Don't render if not active or if there's no texture
if (!mIsVisible || !mTex) return; // Don't render if not visible or if there's no texture
if (!mTex->isTiled()) {
float w, h;
@@ -98,4 +98,13 @@ namespace Game::Object {
}
}
}
void Entity::updateComponents(float deltaTime) {
for (const auto& component : mComponents) {
if (!component || !component->isActive()) {
continue;
}
component->update(deltaTime, this);
}
}
}