also removed target dummy of map state which is no longer needed
Camera::Camera(int width, int height, const Vector<float> *target)
: target(target), halfWidth(width / 2), halfHeight(height / 2) {
Camera::Camera(int width, int height, const Vector<float> *target)
: target(target), halfWidth(width / 2), halfHeight(height / 2) {
- assert(target && "construct camera without target");
}
void Camera::SetTarget(const Vector<float> *t) {
}
void Camera::SetTarget(const Vector<float> *t) {
- assert(t && "cannot change camera target to 0");
target = t;
}
Vector<int> Camera::CalculateOffset() const {
target = t;
}
Vector<int> Camera::CalculateOffset() const {
- return Vector<int>(
- (target->X() - halfWidth) * -1,
- (target->Y() - halfHeight) * -1);
+ if (target) {
+ return Vector<int>(
+ (target->X() - halfWidth) * -1,
+ (target->Y() - halfHeight) * -1);
+ } else {
+ return Vector<int>();
+ }
, map(map)
, controlled(0)
, pushed(0)
, map(map)
, controlled(0)
, pushed(0)
-, tempTarget(20, 20)
-, camera(100, 100, &tempTarget)
, walkingSpeed(64)
, nextDirection(-1)
, afterLock(false)
, walkingSpeed(64)
, nextDirection(-1)
, afterLock(false)
Entity *controlled;
Entity *pushed;
app::Timer<float> moveTimer;
Entity *controlled;
Entity *pushed;
app::Timer<float> moveTimer;
- geometry::Vector<float> tempTarget;
geometry::Vector<int> lastLock;
graphics::Camera camera;
std::vector<Entity *> entities;
geometry::Vector<int> lastLock;
graphics::Camera camera;
std::vector<Entity *> entities;