Animation

This commit is contained in:
2021-03-07 14:06:55 +01:00
parent c7ec12584c
commit bb502b37f4
6 changed files with 74 additions and 16 deletions
+5 -1
View File
@@ -76,12 +76,16 @@ Scene::getObjects( const std::unordered_set< int > &objectIDs ) {
}
return ret;
}
void Scene::movement() {
void Scene::updateScene() {
// check for objects that should be removed
checkKilled();
std::lock_guard< std::mutex > lock( render_mutex );
int now_ticks = SDL_GetTicks();
for ( const auto &x : render_objects ) {
// move objects that should be moved
x->move( now_ticks - prev_ticks );
// animate objects that should be animated
x->animate( now_ticks - prev_ticks );
}
prev_ticks = now_ticks;
}