#include <cassert>
+using math::Fixed;
using math::Vector;
namespace graphics {
-Camera::Camera(int width, int height, const Vector<float> *target)
+Camera::Camera(int width, int height, const Vector<Fixed<8> > *target)
: target(target), halfWidth(width / 2), halfHeight(height / 2) {
}
-void Camera::SetTarget(const Vector<float> *t) {
+void Camera::SetTarget(const Vector<Fixed<8> > *t) {
target = t;
}
Vector<int> Camera::CalculateOffset() const {
if (target) {
return Vector<int>(
- (target->X() - halfWidth) * -1,
- (target->Y() - halfHeight) * -1);
+ (target->X().Int() - halfWidth) * -1,
+ (target->Y().Int() - halfHeight) * -1);
} else {
return Vector<int>();
}