1 #ifndef SPACE_CAMERA_H_
2 #define SPACE_CAMERA_H_
12 Camera(Vector<int> size, 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) { Resize(Vector<int>(w, h)); }
22 void Resize(Vector<int>);
23 void Update(float deltaT);
30 /// transform v from world coords to screen coords
31 Vector<int> ToScreen(Vector<float> v) const {
32 return Vector<int>(ToScale(v - *target)) + offset;
34 /// scale v to current zoom level
35 Vector<float> ToScale(Vector<float> v) const {
39 /// transform v from screen coords to world coords
40 Vector<float> FromScreen(Vector<int> v) const {
41 return FromScale(v - offset) + *target;
43 /// scale v back from current zoom level
44 Vector<float> FromScale(Vector<float> v) const {
49 const Vector<float> *target;