A small game engine for 2D games based of Raylib
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.
|
#pragma once
|
|
|
|
#include <memory>
|
|
#include <vector>
|
|
#include <chrono>
|
|
#include "entity.h"
|
|
|
|
namespace ant::core {
|
|
struct scene {
|
|
static std::shared_ptr<scene> current;
|
|
std::vector<std::shared_ptr<entity>> root_nodes;
|
|
|
|
void update(std::chrono::duration<double> delta_time) {
|
|
for (auto &elem: root_nodes) {
|
|
elem->update(delta_time);
|
|
}
|
|
}
|
|
void render() {
|
|
for (auto &elem: root_nodes | std::views::filter([](const std::shared_ptr<entity>& elem){return elem->visibility_flag();})) {
|
|
elem->render();
|
|
}
|
|
}
|
|
};
|
|
}
|