Pongtroids/simpleCollision.cpp
//helper function for moving an aggregate
helper function for moving an aggregate
helper function for moving an aggregate
void SC::Aggregate::move(float dx, float dy) {
  for(auto& p : points) {
    p.x += dx;
    p.y += dy;
  }
  for(auto& c : circles) {
    c.center.x += dx;
    c.center.y += dy;
  }
  for(auto& r : rects) {
    r.x(r.x() + dx);
    r.y(r.y() + dy);
  }
  for(auto& l : lines) {
    l.a.x += dx;
    l.a.y += dy;
    l.b.x += dx;
    l.b.y += dy;
  }
  for(auto& t : triangles) {
    t.a.x += dx;
    t.a.y += dy;
    t.b.x += dx;
    t.b.y += dy;
    t.c.x += dx;
    t.c.y += dy;
  }
}
void SC :: Aggregate :: move ( float dx , float dy ) { for ( auto & p : points ) { p . x += dx ; p . y += dy ; } for ( auto & c : circles ) { c . center . x += dx ; c . center . y += dy ; } for ( auto & r : rects ) { r . x ( r . x ( ) + dx ) ; r . y ( r . y ( ) + dy ) ; } for ( auto & l : lines ) { l . a . x += dx ; l . a . y += dy ; l . b . x += dx ; l . b . y += dy ; } for ( auto & t : triangles ) { t . a . x += dx ; t . a . y += dy ; t . b . x += dx ; t . b . y += dy ; t . c . x += dx ; t . c . y += dy ; } }
helper function for moving an aggregate
helper function for moving an aggregate