# Add inputs and outputs from these tool invocations to the build variables
CPP_SRCS += \
../src/graphics/Animation.cpp \
+../src/graphics/Camera.cpp \
../src/graphics/ComplexAnimation.cpp \
../src/graphics/Font.cpp \
../src/graphics/Frame.cpp \
OBJS += \
./src/graphics/Animation.o \
+./src/graphics/Camera.o \
./src/graphics/ComplexAnimation.o \
./src/graphics/Font.o \
./src/graphics/Frame.o \
CPP_DEPS += \
./src/graphics/Animation.d \
+./src/graphics/Camera.d \
./src/graphics/ComplexAnimation.d \
./src/graphics/Font.d \
./src/graphics/Frame.d \
# Add inputs and outputs from these tool invocations to the build variables
CPP_SRCS += \
../src/graphics/Animation.cpp \
+../src/graphics/Camera.cpp \
../src/graphics/ComplexAnimation.cpp \
../src/graphics/Font.cpp \
../src/graphics/Frame.cpp \
OBJS += \
./src/graphics/Animation.o \
+./src/graphics/Camera.o \
./src/graphics/ComplexAnimation.o \
./src/graphics/Font.o \
./src/graphics/Frame.o \
CPP_DEPS += \
./src/graphics/Animation.d \
+./src/graphics/Camera.d \
./src/graphics/ComplexAnimation.d \
./src/graphics/Font.d \
./src/graphics/Frame.d \
--- /dev/null
+/*
+ * Camera.cpp
+ *
+ * Created on: Sep 29, 2012
+ * Author: holy
+ */
+
+#include "Camera.h"
+
+#include <cassert>
+
+using geometry::Vector;
+
+namespace graphics {
+
+Camera::Camera(int width, int height, const Vector<int> *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");
+ target = t;
+}
+
+
+Vector<int> Camera::CalculateOffset() const {
+ return Vector<int>(
+ (target->X() - halfWidth) * -1,
+ (target->Y() - halfHeight) * -1);
+}
+
+}
--- /dev/null
+/*
+ * Camera.h
+ *
+ * Created on: Sep 29, 2012
+ * Author: holy
+ */
+
+#ifndef GRAPHICS_CAMERA_H_
+#define GRAPHICS_CAMERA_H_
+
+#include "../geometry/Vector.h"
+
+namespace graphics {
+
+class Camera {
+
+public:
+ Camera(int width, int height, const geometry::Vector<int> *target);
+ ~Camera() { }
+
+public:
+ void Resize(int w, int h) { halfWidth = w / 2; halfHeight = h / 2; }
+ void SetTarget(const geometry::Vector<int> *t);
+
+ geometry::Vector<int> CalculateOffset() const;
+
+private:
+ const geometry::Vector<int> *target;
+ int halfWidth;
+ int halfHeight;
+
+};
+
+}
+
+#endif /* GRAPHICS_CAMERA_H_ */
class Animation;
class AnimationRunner;
+class Camera;
class Color;
class ComplexAnimation;
class Font;