Movement is now much smoother for the easing functions and I can pan around better, but it's hard coded to only do pan at the moment.

This commit is contained in:
Zed A. Shaw 2025-11-09 01:40:15 -05:00
parent 2ebefcce05
commit 0d326089f7
8 changed files with 37 additions and 47 deletions

View file

@ -3,13 +3,12 @@
#include "animation.hpp"
namespace storyboard {
UI::UI() :
$view_texture({SCREEN_WIDTH, SCREEN_HEIGHT}),
$view_sprite($view_texture.getTexture())
{
$view_sprite.setPosition({0, 0});
$camera.style("dolly");
$camera.style("pan");
}
void UI::init() {
@ -31,6 +30,7 @@ namespace storyboard {
zoom($zoom_target);
}
$view_texture.clear();
$ui.render($view_texture);
$ui.debug_layout($view_texture);
$view_texture.display();
@ -38,17 +38,13 @@ namespace storyboard {
}
bool UI::mouse(float x, float y, guecs::Modifiers mods) {
auto& cell = $ui.cell_for($zoom_target);
$camera.position(cell.mid_x, cell.mid_y);
if(zoomed) {
zoomed = false;
reset();
} else {
zoomed = true;
auto target = $ui.$parser.hit(x, y);
$zoom_target = *target;
zoom($zoom_target);
$camera.play();
}
$zoom_target = *$ui.$parser.hit(x, y);
zoom($zoom_target);
$camera.play();
return $ui.mouse(x, y, mods);
}