1 #ifndef SPACE_CAMERA_H_
2 #define SPACE_CAMERA_H_
4 #include "../math/Vector.h"
12 Camera(int w, int h, const Vector<float> &);
15 void SetTarget(const Vector<float> &t) { target = &t; }
16 void SetZoom(float z) { zoom = z; }
18 void Resize(int w, int h);
19 void Update(float deltaT);
24 Vector<int> ToScreen(Vector<float> v) const {
25 return Vector<int>(OffsetOf(v));
27 Vector<float> OffsetOf(Vector<float> v) const {
28 return ToScale(v - *target) + offset;
30 Vector<float> ToScale(Vector<float> v) const {
33 } else if (zoom > 0) {
34 return v * float(1 << zoom);
36 return v / float(1 << -zoom);
41 const Vector<float> *target;