Better working camera that is constrained in the bounds, but the animations don't follow the bounding.

This commit is contained in:
Zed A. Shaw 2026-01-01 12:59:39 -05:00
parent 6dc9d564c6
commit 51bb74e2d7
9 changed files with 93 additions and 33 deletions

View file

@ -6,20 +6,24 @@ namespace cinematic {
struct Camera {
components::Animation anim;
sf::View view;
sf::Vector2f base_size{SCREEN_WIDTH, SCREEN_HEIGHT};
sf::Vector2f size{SCREEN_WIDTH, SCREEN_HEIGHT};
sf::FloatRect camera_bounds{{0,0},{SCREEN_WIDTH, SCREEN_HEIGHT}};
sf::Vector2f aimed_at{0,0};
sf::Vector2f going_to{0,0};
Camera();
Camera(sf::Vector2f base_size);
void resize(float width, float height);
void resize(float width);
void scale(float ratio);
void position(float x, float y);
void move(float x, float y);
bool playing();
void render(sf::RenderTexture& target);
void play();
void style(const std::string &name);
void reset(sf::RenderTexture& target, float width, float height);
void reset(sf::RenderTexture& target);
void update_camera_bounds(sf::Vector2f size);
};
void init();