Fixed player showing up as an enemy and did better map centering.

This commit is contained in:
Zed A. Shaw 2025-02-11 11:10:18 -05:00
parent e2bd61a1e4
commit 421cca308b
5 changed files with 13 additions and 19 deletions

20
gui.cpp
View file

@ -111,10 +111,8 @@ namespace gui {
$renderer.init_terminal();
$map_view.create_render();
$renderer.resize_grid(MAX_FONT_SIZE, $map_view);
$map_view.resize_canvas();
state(State::IDLE);
}
@ -150,7 +148,7 @@ namespace gui {
// just do 10 ticks
if($rotation_count % 10 == 0) {
run_systems();
$rayview.$anim.play(true);
$rayview.$anim.play(false);
$rotation = -10.0f;
state(State::IDLE);
}
@ -195,6 +193,8 @@ namespace gui {
state(State::ROTATING);
break;
case FU::MAP_OPEN:
$renderer.resize_grid(MAX_FONT_SIZE, $map_view);
$map_view.resize_canvas();
state(State::MAPPING);
break;
case FU::ATTACK:
@ -310,26 +310,26 @@ namespace gui {
}
void FSM::render() {
auto start = std::chrono::high_resolution_clock::now();
if(in_state(State::MAPPING)) {
$window.clear();
$map_view.render();
$renderer.draw($map_view);
} else {
auto start = std::chrono::high_resolution_clock::now();
$rayview.draw($window);
auto end = std::chrono::high_resolution_clock::now();
auto elapsed = std::chrono::duration<double>(end - start);
$stats.sample(1/elapsed.count());
draw_weapon();
}
auto end = std::chrono::high_resolution_clock::now();
auto elapsed = std::chrono::duration<double>(end - start);
$stats.sample(1/elapsed.count());
draw_gui();
draw_weapon();
$window.display();
}
void FSM::mouse() {
// temporarily gutted
}
void FSM::generate_map() {