//////////////////////////////////////////////////////////////////////////////
// This file is part of the Journey MMORPG client //
// Copyright © 2015-2016 Daniel Allendorf //
// //
// This program is free software: you can redistribute it and/or modify //
// it under the terms of the GNU Affero General Public License as //
// published by the Free Software Foundation, either version 3 of the //
// License, or (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU Affero General Public License for more details. //
// //
// You should have received a copy of the GNU Affero General Public License //
// along with this program. If not, see . //
//////////////////////////////////////////////////////////////////////////////
#pragma once
#include "../Template/Interpolated.h"
#include "../Template/Point.h"
#include "../Template/Range.h"
#include
namespace jrc
{
// View on stage which follows the player object.
class Camera
{
public:
// Initialize everything to 0, we need the player's spawnpoint first to properly set the position.
Camera();
// Update the view with the current player position. (Or any other target)
void update(Point position);
// Set the position, changing the view immediatly.
void set_position(Point position);
// Updates the view's boundaries. Determined by mapinfo or footholds.
void set_view(Range hborders, Range vborders);
// Return the current position.
Point position() const;
// Return the interpolated position.
Point position(float alpha) const;
// Return the interpolated position.
Point realposition(float alpha) const;
private:
// Movement variables.
Linear x;
Linear y;
// View limits.
Range hbounds;
Range vbounds;
};
}