Now have a simple storyboard system that can display an image and move with the camera to different cells.

This commit is contained in:
Zed A. Shaw 2025-11-04 00:20:49 -05:00
parent 068eeeecd1
commit 4bda2ee01c
10 changed files with 118 additions and 40 deletions

View file

@ -45,10 +45,6 @@ namespace boss {
$actions.render(window);
$combat_ui.render(window);
if($camera.playing()) {
zoom("player2");
}
$arena.render($view_texture);
$view_texture.display();
window.draw($view_sprite);
@ -77,17 +73,13 @@ namespace boss {
}
void UI::zoom(const std::string &cell_name) {
if(cell_name == "") {
sf::View zoom{{BOSS_VIEW_WIDTH/2,BOSS_VIEW_HEIGHT/2}, {BOSS_VIEW_WIDTH, BOSS_VIEW_HEIGHT}};
$view_texture.setView(zoom);
} else if($camera.playing()) {
auto& cell = $arena.$ui.cell_for(cell_name);
auto& cell = $arena.$ui.cell_for(cell_name);
$camera.resize({BOSS_VIEW_WIDTH/2, BOSS_VIEW_HEIGHT/2});
$camera.move($view_texture,
{float(cell.x/2), float(cell.y/2)});
}
$camera.resize({BOSS_VIEW_WIDTH/2, BOSS_VIEW_HEIGHT/2});
$camera.move($view_texture,
{float(cell.x/2), float(cell.y/2)});
$view_sprite.setPosition({BOSS_VIEW_X, BOSS_VIEW_Y});
// BUG: do I need this?
// $view_sprite.setPosition({BOSS_VIEW_X, BOSS_VIEW_Y});
}
}