SDLPP: Add scene pause function

This commit is contained in:
2022-09-24 22:51:32 +02:00
parent aa5043a811
commit 9e4cc97f79
2 changed files with 15 additions and 0 deletions
+11
View File
@@ -90,6 +90,9 @@ Scene::getObjects( const std::unordered_set< int > &objectIDs ) {
return ret;
}
void Scene::updateScene() {
if(paused) {
return;
}
// check for objects that should be removed
checkKilled();
std::lock_guard< std::mutex > lock( render_mutex );
@@ -102,6 +105,14 @@ void Scene::updateScene() {
}
prev_ticks = now_ticks;
}
void Scene::pauseScene() {
paused = true;
diff_ticks = SDL_GetTicks() - prev_ticks;
}
void Scene::unpauseScene() {
paused = false;
prev_ticks = SDL_GetTicks() - diff_ticks;
}
std::vector< std::pair< uint64_t, std::shared_ptr< RenderObject > > >
Scene::getCollisions( RenderObject &r ) {
if ( r.getHidden() )