Can now pan and move the camera to focus on bosses, player, and their actions.
This commit is contained in:
parent
51bb74e2d7
commit
22db12f5e4
6 changed files with 38 additions and 28 deletions
22
camera.cpp
22
camera.cpp
|
|
@ -29,9 +29,13 @@ namespace cinematic {
|
|||
}
|
||||
|
||||
Camera::Camera(sf::Vector2f size) :
|
||||
anim(MGR.animations.at("shake")),
|
||||
anim(MGR.animations.at("dolly")),
|
||||
size(size),
|
||||
base_size(size),
|
||||
size(size)
|
||||
aimed_at{size.x/2, size.y/2},
|
||||
going_to{size.x/2, size.y/2},
|
||||
camera_bounds{{0,0}, size},
|
||||
view{aimed_at, size}
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -42,10 +46,6 @@ namespace cinematic {
|
|||
{size.x / 2.0f, size.y / 2.0f},
|
||||
{base_size.x - size.x / 2.0f, base_size.y - size.y / 2.0f}
|
||||
};
|
||||
|
||||
fmt::println("!!!!! CAMERA BOUNDS camera_bounds={},{},{},{}",
|
||||
camera_bounds.position.x, camera_bounds.position.y,
|
||||
camera_bounds.size.x, camera_bounds.size.y);
|
||||
}
|
||||
|
||||
void Camera::scale(float ratio) {
|
||||
|
|
@ -69,22 +69,12 @@ namespace cinematic {
|
|||
void Camera::position(float x, float y) {
|
||||
aimed_at.x = clamp(x, camera_bounds.position.x, camera_bounds.size.x);
|
||||
aimed_at.y = clamp(y, camera_bounds.position.y, camera_bounds.size.y);
|
||||
|
||||
fmt::println("!!! CAMERA POSITION aimed_at={},{}; x/y={},{}; camera_bounds={},{},{},{}",
|
||||
aimed_at.x, aimed_at.y, x, y,
|
||||
camera_bounds.position.x, camera_bounds.position.y,
|
||||
camera_bounds.size.x, camera_bounds.size.y);
|
||||
}
|
||||
|
||||
void Camera::move(float x, float y) {
|
||||
going_to.x = clamp(x, camera_bounds.position.x, camera_bounds.size.x);
|
||||
going_to.y = clamp(y, camera_bounds.position.y, camera_bounds.size.y);
|
||||
|
||||
fmt::println("!!!! CAMERA MOVE going_to={},{}; x/y={},{}; camera_bounds={},{},{},{}",
|
||||
going_to.x, going_to.y, x, y,
|
||||
camera_bounds.position.x, camera_bounds.position.y,
|
||||
camera_bounds.size.x, camera_bounds.size.y);
|
||||
|
||||
// BUG: annoying special case
|
||||
if(anim.motion == ease::SLIDE) {
|
||||
anim.min_x = aimed_at.x;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue