Tried to get camera to have a reset but couldn't figure out.

This commit is contained in:
Zed A. Shaw 2025-11-09 12:54:38 -05:00
parent 29409c54ce
commit de7f9f3445
4 changed files with 37 additions and 34 deletions

View file

@ -32,32 +32,35 @@ namespace cinematic {
{
}
void Camera::resize(sf::Vector2f to) {
size = to;
void Camera::resize(float width, float height) {
size = {width, height};
}
void Camera::style(const std::string &name) {
anim = MGR.animations.at(name);
}
void Camera::focus(float x, float y) {
position.x = x;
position.y = y;
void Camera::position(float x, float y) {
aimed_at = {x, y};
}
void Camera::move(sf::RenderTexture& target, sf::Vector2f pos) {
sf::View zoom;
void Camera::move(float x, float y) {
going_to = {x, y};
// BUG: annoying special case
if(anim.motion == ease::SLIDE) {
anim.min_x = position.x;
anim.min_y = position.y;
anim.max_x = pos.x;
anim.max_y = pos.y;
anim.min_x = aimed_at.x;
anim.min_y = aimed_at.y;
anim.max_x = going_to.x;
anim.max_y = going_to.y;
}
}
anim.apply(zoom, pos, size);
target.setView(zoom);
void Camera::render(sf::RenderTexture& target) {
if(anim.playing) {
anim.apply(view, going_to, size);
target.setView(view);
}
}
bool Camera::playing() {