Skip to content

Instantly share code, notes, and snippets.

@clooth
Created September 23, 2013 12:56
Show Gist options
  • Save clooth/6670025 to your computer and use it in GitHub Desktop.
Save clooth/6670025 to your computer and use it in GitHub Desktop.
// Map scrolling functions
auto panMap = [&mapView, &minimapView] (float speed, int dir) {
float timeValue = TimePerFrame.asSeconds();
float moveValue = speed * timeValue;
if (dir == 0) { mapView.move(-moveValue, 0.f); minimapView.move(-moveValue, 0.f); }
if (dir == 1) { mapView.move(moveValue, 0.f); minimapView.move(moveValue, 0.f); }
if (dir == 2) { mapView.move(0.f, -moveValue); minimapView.move(0.f, -moveValue); }
if (dir == 3) { mapView.move(0.f, moveValue); minimapView.move(0.f, moveValue); }
};
auto panMapLeft = [panMap] (float speed) { panMap(speed, 0); };
auto panMapRight = [panMap] (float speed) { panMap(speed, 1); };
auto panMapUp = [panMap] (float speed) { panMap(speed, 2); };
auto panMapDown = [panMap] (float speed) { panMap(speed, 3); };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment