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 Vector<int> ScreenSize() const { return size; }
19 float Zoom() const { return zoom; }
21 void Resize(int w, int h);
22 void Update(float deltaT);
29 /// transform v from world coords to screen coords
30 Vector<int> ToScreen(Vector<float> v) const {
31 return Vector<int>(ToScale(v - *target)) + offset;
33 /// scale v to current zoom level
34 Vector<float> ToScale(Vector<float> v) const {
38 /// transform v from screen coords to world coords
39 Vector<float> FromScreen(Vector<int> v) const {
40 return FromScale(v - offset) + *target;
42 /// scale v back from current zoom level
43 Vector<float> FromScale(Vector<float> v) const {
48 const Vector<float> *target;