storyboard::UI now adapts the camera to fit the story beats, but really story should do that.

This commit is contained in:
Zed A. Shaw 2026-02-22 12:14:42 -05:00
parent d56b4bd335
commit 024d0cfae7
9 changed files with 123 additions and 19 deletions

View file

@ -17,15 +17,20 @@ namespace cinematic {
void init() {
if(!initialized) {
// BUG: it should be that you give a camera to load by name, not just one for all cameras
auto data = settings::get("cameras");
auto anim = components::convert<Animate2>(data["cameras"]);
MGR.animations.try_emplace("main", anim);
for(auto [key, value] : data.json().items()) {
auto anim = components::convert<Animate2>(value);
MGR.animations.try_emplace(key, anim);
}
initialized = true;
}
}
Camera::Camera(sf::Vector2f size) :
anim(MGR.animations.at("main")),
Camera::Camera(sf::Vector2f size, const std::string &name) :
anim(MGR.animations.at(name)),
size(size),
base_size(size),
aimed_at{size.x/2, size.y/2},
@ -33,6 +38,8 @@ namespace cinematic {
camera_bounds{{0,0}, size},
view{aimed_at, size}
{
anim.sheet.frame_width = base_size.x;
anim.sheet.frame_height = base_size.y;
}
void Camera::update_camera_bounds(sf::Vector2f size) {