]> git.localhorst.tv Git - sdl-test8.git/blob - src/shape/Shape.h
69eedc252e7f19f1720aa55ea2a833a3b7a7591a
[sdl-test8.git] / src / shape / Shape.h
1 /*
2  * Shape.h
3  *
4  *  Created on: Apr 29, 2012
5  *      Author: holy
6  */
7
8 #ifndef SHAPE_SHAPE_H_
9 #define SHAPE_SHAPE_H_
10
11 #include "../geometry/Ray2D.h"
12 #include "../geometry/Vector2D.h"
13
14 #include <ostream>
15
16
17 namespace shape {
18
19 class AABB;
20 class Circle;
21
22 class Shape {
23
24         public:
25                 typedef float Scalar;
26                 typedef geometry::Vector2D<Scalar> Vector;
27                 typedef geometry::Ray2D<Scalar> Ray;
28
29         public:
30                 virtual ~Shape(void) { };
31
32         public:
33                 virtual void Translate(const Vector &delta) = 0;
34                 virtual void Rotate(Scalar delta) = 0;
35
36         public:
37                 virtual bool CheckCollision(const Shape &, Ray &) const = 0;
38                 virtual bool CheckCollision(const AABB &, Ray &) const = 0;
39                 virtual bool CheckCollision(const Circle &, Ray &) const = 0;
40
41         public:
42                 virtual std::ostream &Write(std::ostream &) const = 0;
43
44 };
45
46
47 inline std::ostream &operator <<(std::ostream &out, const Shape &s) {
48         return s.Write(out);
49 };
50
51 }
52
53 #endif /* SHAPE_SHAPE_H_ */