diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/interface.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/game/interface.cpp b/src/game/interface.cpp index 41e2365..0ffdbab 100644 --- a/src/game/interface.cpp +++ b/src/game/interface.cpp @@ -39,6 +39,15 @@ void state_t::tick(double dt) view_size.y = view_scale * size.y / size.x; } + if (game->selected_units.size() && camera.following) { + for (entity_t *ent : game->selected_units) + follow_center += ent->render_bounds.center(); + follow_center /= game->selected_units.size(); + + camera.follow_center[0] = expfade(camera.follow_center[0], follow_center[0], dt, 25); + camera.follow_center[1] = expfade(camera.follow_center[1], follow_center[1], dt, 25); + } + view_center = camera.center; if (camera.following) @@ -156,17 +165,6 @@ void state_t::tick(double dt) } } - if (game->selected_units.size() && camera.following) { - for (entity_t *ent : game->selected_units) - follow_center += ent->render_bounds.center(); - follow_center /= game->selected_units.size(); - - - camera.follow_center = follow_center; - //camera.follow_center[0] = expfade(camera.follow_center[0], follow_center[0], dt, 5); - //camera.follow_center[1] = expfade(camera.follow_center[1], follow_center[1], dt, 5); - } - // Compute this _after_ the setView above. wmouse = window->mapPixelToCoords(sf::Mouse::getPosition(*window)); |