Now can zoom in on the player when it's their turn.
This commit is contained in:
parent
740e1052fe
commit
cb58bdd955
3 changed files with 21 additions and 2 deletions
14
boss/ui.cpp
14
boss/ui.cpp
|
|
@ -66,4 +66,18 @@ namespace boss {
|
|||
void UI::play_animations() {
|
||||
$arena.play_animations();
|
||||
}
|
||||
|
||||
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 {
|
||||
auto& cell = $arena.$ui.cell_for(cell_name);
|
||||
sf::View zoom{{(float)cell.mid_x, (float)cell.mid_y},
|
||||
{(float)cell.w*3, (float)cell.h*3}};
|
||||
$view_texture.setView(zoom);
|
||||
}
|
||||
|
||||
$view_sprite.setPosition({BOSS_VIEW_X, BOSS_VIEW_Y});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue