+/*
+ * Ball.cpp
+ *
+ * Created on: Apr 9, 2012
+ * Author: holy
+ */
+
+#include "Ball.h"
+
+#include "Paddle.h"
+#include "../geometry/constants.h"
+
+#include <cmath>
+#include <SDL/SDL_gfxPrimitives.h>
+
+using game::Entity;
+using geometry::PI;
+
+
+namespace pong {
+
+Ball::Ball(Scalar r)
+: Entity(&shape, 4 * PI * r * r * r / 3)
+, shape(r) {
+
+}
+
+
+void Ball::Render(SDL_Surface *screen) const {
+ circleRGBA(screen, shape.Center().X(), shape.Center().Y(), shape.Radius(), 0xFF, 0xFF, 0xFF, 0xFF);
+ Vector angle(Vector(0, 1).Rotate(Angle()) * shape.Radius() + Origin());
+ lineRGBA(screen, shape.Center().X(), shape.Center().Y(), angle.X(), angle.Y(), 0xFF, 0xFF, 0xFF, 0xFF);
+}
+
+}