Player's aim is now updated constantly as they move, just need to solve #57 to complete it. Closes #9.

This commit is contained in:
Zed A. Shaw 2025-07-05 11:18:26 -04:00
parent 584c4e9f67
commit a26f0b0c0a
7 changed files with 48 additions and 27 deletions

View file

@ -45,27 +45,26 @@ namespace gui {
$overlay_ui.render($window);
}
void MainUI::health_low() {
$overlay_ui.show_sprite("middle", "blood_splatter");
}
lel::Cell MainUI::overlay_cell(const std::string& name) {
return $overlay_ui.$gui.cell_for(name);
}
bool MainUI::play_rotate() {
bool done = $rayview.play_rotate();
$needs_render = !done;
return done;
std::optional<Point> MainUI::play_rotate() {
if($rayview.play_rotate()) {
$needs_render = false;
return std::make_optional<Point>($rayview.aiming_at);
} else {
$needs_render = true;
return std::nullopt;
}
}
std::optional<Point> MainUI::play_move() {
std::optional<components::Position> MainUI::play_move() {
if($rayview.play_move()) {
$needs_render = false;
return std::make_optional<Point>(
$rayview.camera_target());
return std::make_optional<Position>(
$rayview.camera_target(),
$rayview.aiming_at);
} else {
$needs_render = true;
return std::nullopt;
@ -104,6 +103,9 @@ namespace gui {
$rayview.update_level($level);
$rayview.position_camera(player.x + 0.5, player.y + 0.5);
// BUG #57: I think this is in the wrong direction?
player_position.aiming_at = $rayview.aiming_at;
$compass_dir = 0;
$overlay_ui.update_level(level);