Elements used in the Balls and Things games for the RETRO.

Dependents:   RETRO_BallsAndPaddle RETRO_BallAndHoles

Revision:
3:441dc90d10ce
Parent:
0:3d0db4e183ee
Child:
4:f421e34313d3
--- a/Shapes.h	Wed Feb 25 10:43:15 2015 +0000
+++ b/Shapes.h	Thu Feb 26 11:46:46 2015 +0000
@@ -2,6 +2,9 @@
 #include "mbed.h"
 #include "Vector.h"
 
+#define MAX(x, y) (((x) > (y)) ? (x) : (y))
+#define MIN(x, y) (((x) < (y)) ? (x) : (y))
+
 class Point
 { 
 protected :
@@ -15,6 +18,24 @@
     void set(int x, int y);
 };
 
+class Rectangle;    // predefinition needed by Line class
+
+class Line
+{
+protected :
+    int x1, x2, y1, y2;
+
+public :
+    Line(int x1,int y1, int x2, int y2);
+    Line(Point p1, Point p2);
+    Point get1();
+    Point get2();
+    float getSizeFloat();
+    int getSize();
+    Rectangle getBoundingRectangle();
+    int getDistance(Point pt);
+};
+
 class Rectangle
 {
 protected :
@@ -60,5 +81,6 @@
     void move(int x, int y);
     void move(Vector v);
     Rectangle getBoundingRectangle();
+    bool collides(Line l);
 };