1 #ifndef _wall_h 2 #define _wall_h 3 4 #ifndef _object_h 5 # include "object.h" 6 #endif 7 #ifndef _vec2_h 8 # include "vec2.h" 9 #endif 10 11 // 12 // ------------------------------------------------------------------------- 13 // class Wall: Begrenzungs-Objekt 14 // ------------------------------------------------------------------------- 15 // 16 17 class Wall : public Object { 18 public: 19 Wall( double x1, double y1, double x2, double y2 ); 20 Wall( const Vec2 &v1, const Vec2 &v2 ); 21 virtual ~Wall(); 22 23 virtual Real HitFromBall( Ball *b ); 24 virtual void CollideWithBall( Ball *b ); 25 virtual void Info(); 26 27 protected: 28 Vec2 p1,p2; 29 30 Vec2 d; // p2-p1 31 Vec2 ds; // normierter Vektor senkrecht zu d 32 33 friend class Pool; 34 }; 35 36 // 37 // ------------------------------------------------------------------------- 38 // class XWall: Wand ohne Begrenzung 39 // ------------------------------------------------------------------------- 40 // 41 42 class XWall : public Wall { 43 public: XWall(double x,double y1,double y2)44 XWall( double x, double y1, double y2 ) : Wall(x,y1,x,y2) { ; } 45 virtual ~XWall(); 46 Real HitFromBall( Ball *b ); 47 void CollideWithBall( Ball *b ); 48 }; 49 // 50 // ------------------------------------------------------------------------- 51 // class YWall: Wand ohne Begrenzung 52 // ------------------------------------------------------------------------- 53 // 54 55 class YWall : public Wall { 56 public: YWall(double x1,double x2,double y)57 YWall( double x1, double x2, double y ) : Wall(x1,y,x2,y) { ; } 58 virtual ~YWall(); 59 Real HitFromBall( Ball *b ); 60 void CollideWithBall( Ball *b ); 61 }; 62 63 #endif 64