]> git.localhorst.tv Git - l2e.git/blobdiff - src/graphics/Camera.cpp
removed stupid file headers that eclipse put in
[l2e.git] / src / graphics / Camera.cpp
index d43864ad6d2a44eef942251382c1f56f2f1300ea..6039586ffb7eca0caa7be2703753b977ea9f54a1 100644 (file)
@@ -1,10 +1,3 @@
-/*
- * Camera.cpp
- *
- *  Created on: Sep 29, 2012
- *      Author: holy
- */
-
 #include "Camera.h"
 
 #include <cassert>
@@ -13,22 +6,25 @@ using geometry::Vector;
 
 namespace graphics {
 
-Camera::Camera(int width, int height, const Vector<int> *target)
+Camera::Camera(int width, int height, const Vector<float> *target)
 : target(target), halfWidth(width / 2), halfHeight(height / 2) {
-       assert(target && "construct camera without target");
+
 }
 
 
-void Camera::SetTarget(const Vector<int> *t) {
-       assert(t && "cannot change camera target to 0");
+void Camera::SetTarget(const Vector<float> *t) {
        target = t;
 }
 
 
 Vector<int> Camera::CalculateOffset() const {
-       return Vector<int>(
-                       (target->X() - halfWidth) * -1,
-                       (target->Y() - halfHeight) * -1);
+       if (target) {
+               return Vector<int>(
+                               (target->X() - halfWidth) * -1,
+                               (target->Y() - halfHeight) * -1);
+       } else {
+               return Vector<int>();
+       }
 }
 
 }