Nazaj na multithreadanje - fonti
This commit is contained in:
@@ -39,12 +39,14 @@ namespace Game::Renderer {
|
||||
void Renderer::renderFrame() {
|
||||
mClear();
|
||||
|
||||
// Get gamestate and render the objects here; GameState::getState().objects or something, idk
|
||||
auto entities = Game::State::GameState::getInstance().getEntitiesRef();
|
||||
//LOG("Entity count: " << entities->size());
|
||||
|
||||
for (auto& entity : *entities) {
|
||||
entity->render(this);
|
||||
try {
|
||||
Game::State::GameState::getInstance().withEntitiesLocked([this](auto& entities) {
|
||||
for (auto& entity : entities) {
|
||||
entity->render(this);
|
||||
}
|
||||
});
|
||||
} catch (const std::exception& e) {
|
||||
ERROR("Exception while rendering frame: " << e.what());
|
||||
}
|
||||
|
||||
mPresent();
|
||||
|
||||
Reference in New Issue
Block a user