   problems implementing simple AABB in OPENGL / C++
  Hi Ive been reading and playing around for a while now. I can create a struct and I can also create an image and get that to move around the screen via the keyboard but I still cant assign the image to the struct to make the collision I have code for. I was trying to implement something similar to the code below for physics. Should this be in a separate physics file or included in main file but change the main function? If anyone has any pointers Id greatly appreciate it as a bit lost at the moment. {    class Program    {    struct sprite   {  public int x, y, width, height;  public sprite(int x, int y, int width, int height) {this.x = x;this.y = y;this.width = width;this.height = height; }    } static int Sprite_Collide(sprite object1, sprite object2)   {  int left1, left2;  int right1, right2;  int top1, top2;  int bottom1, bottom2;  left1 = object1.x;  left2 = object2.x;  right1 = object1.x + object1.width;  right2 = object2.x + object2.width;  top1 = object1.y;  top2 = object2.y;  bottom1 = object1.y + object1.height;  bottom2 = object2.y + object2.height;  if (bottom1 < top2) return 0;  if (top1 > bottom2) return 0;  if (right1 < left2) return 0;  if (left1 > right2) return 0;  return 1;   }  static void Main(string[] args)   { sprite object1 = new sprite(0,0,5,5); sprite object2 = new sprite(0,0,5,5); int i = Sprite_Collide(object1, object2); System.Console.WriteLine(i);  if (i == 1) { System.Console.WriteLine("You've wrecked your CAAARRRRR"); } else  { System.Console.WriteLine("As you were"); }}    }}   
  so i put the above code in a physics.cpp file and put #include physics.cpp in the main file. Now because its a .cpp file written in c++ / opengl do i need to change the format removing the class etc?   ;Quote:Original post by macmacmacso i put the above code in a physics.cpp file and put #include physics.cpp in the main file. Now because its a .cpp file written in c++ / opengl do i need to change the format removing the class etc?This is C++/CLI, not C++. They're similar in some ways, but are definitely two distinct languages.   ;  I'm using visual studio to write C++ (win32) and using an Opengl template which was originally a rotating shape. So do I need to rewrite into c++ in a separate physics file and then #include it in main? short int Sprite_Collide(sprite_ptr object1, sprite_ptr object2) {int left1, left2;    int right1, right2;    int top1, top2;    int bottom1, bottom2;    left1 = object1->x;    left2 = object2->x;    right1 = object1->x + object1->width;    right2 = object2->x + object2->width;    top1 = object1->y;    top2 = object2->y;    bottom1 = object1->y + object1->height;    bottom2 = object2->y + object2->height;    if (bottom1 < top2) return(0);    if (top1 > bottom2) return(0);    if (right1 < left2) return(0);    if (left1 > right2) return(0);    return(1);};