Tried to get camera to have a reset but couldn't figure out.
This commit is contained in:
parent
29409c54ce
commit
de7f9f3445
4 changed files with 37 additions and 34 deletions
|
|
@ -26,25 +26,28 @@ namespace storyboard {
|
|||
}
|
||||
|
||||
void UI::render(sf::RenderWindow &window) {
|
||||
if($camera.playing()) {
|
||||
zoom($zoom_target);
|
||||
}
|
||||
|
||||
$view_texture.clear();
|
||||
|
||||
$camera.render($view_texture);
|
||||
$ui.render($view_texture);
|
||||
$ui.debug_layout($view_texture);
|
||||
|
||||
$view_texture.display();
|
||||
window.draw($view_sprite);
|
||||
}
|
||||
|
||||
bool UI::mouse(float x, float y, guecs::Modifiers mods) {
|
||||
auto& cell = $ui.cell_for($zoom_target);
|
||||
$camera.focus(cell.mid_x, cell.mid_y);
|
||||
|
||||
$zoom_target = *$ui.$parser.hit(x, y);
|
||||
|
||||
zoom($zoom_target);
|
||||
$camera.play();
|
||||
if($zoom_target == "a") {
|
||||
reset();
|
||||
} else {
|
||||
$camera.position(cell.mid_x, cell.mid_y);
|
||||
zoom($zoom_target);
|
||||
$camera.play();
|
||||
}
|
||||
|
||||
return $ui.mouse(x, y, mods);
|
||||
}
|
||||
|
|
@ -52,9 +55,8 @@ namespace storyboard {
|
|||
void UI::zoom(const std::string &cell_name) {
|
||||
auto& cell = $ui.cell_for(cell_name);
|
||||
|
||||
$camera.resize({float(cell.w), float(cell.h)});
|
||||
$camera.move($view_texture,
|
||||
{float(cell.mid_x), float(cell.mid_y)});
|
||||
$camera.resize(float(cell.w), float(cell.h));
|
||||
$camera.move(float(cell.mid_x), float(cell.mid_y));
|
||||
}
|
||||
|
||||
void UI::reset() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue