Lots of dumb little edits to sort out what I'm aiming at. I'll next clean out most of this in a refactor.
This commit is contained in:
parent
1f90367f51
commit
c7c48658bd
13 changed files with 60 additions and 29 deletions
21
main_ui.cpp
21
main_ui.cpp
|
@ -8,7 +8,8 @@ namespace gui {
|
|||
|
||||
MainUI::MainUI(sf::RenderWindow& window) :
|
||||
$window(window),
|
||||
$rayview(RAY_VIEW_WIDTH, RAY_VIEW_HEIGHT)
|
||||
$rayview(RAY_VIEW_WIDTH, RAY_VIEW_HEIGHT),
|
||||
$camera($rayview)
|
||||
{
|
||||
$window.setVerticalSyncEnabled(VSYNC);
|
||||
$window.setFramerateLimit(FRAME_LIMIT);
|
||||
|
@ -42,6 +43,13 @@ namespace gui {
|
|||
}
|
||||
|
||||
void MainUI::render() {
|
||||
auto aimed_at = $camera.aimed_at();
|
||||
if($level.collision->occupied(aimed_at)) {
|
||||
$rayview.aiming_at = $level.collision->get(aimed_at);
|
||||
} else {
|
||||
$rayview.aiming_at = 0;
|
||||
}
|
||||
|
||||
if($show_level) {
|
||||
auto time = $clock.getElapsedTime();
|
||||
auto st = textures::get("down_the_well");
|
||||
|
@ -64,14 +72,15 @@ namespace gui {
|
|||
}
|
||||
|
||||
bool MainUI::play_rotate() {
|
||||
bool done = $camera.play_rotate($rayview);
|
||||
bool done = $camera.play_rotate();
|
||||
$needs_render = !done;
|
||||
|
||||
return done;
|
||||
}
|
||||
|
||||
// this could be an optional that returs a Point
|
||||
std::optional<Point> MainUI::play_move() {
|
||||
if($camera.play_move($rayview)) {
|
||||
if($camera.play_move()) {
|
||||
$needs_render = false;
|
||||
Point pos{
|
||||
size_t($camera.target_x),
|
||||
|
@ -88,15 +97,15 @@ namespace gui {
|
|||
// -1 is left, 1 is right
|
||||
$compass_dir = ($compass_dir + dir) % $compass.size();
|
||||
$overlay_ui.show_text("left", $compass[$compass_dir]);
|
||||
$camera.plan_rotate($rayview, dir);
|
||||
$camera.plan_rotate(dir);
|
||||
}
|
||||
|
||||
Point MainUI::plan_move(int dir, bool strafe) {
|
||||
return $camera.plan_move($rayview, dir, strafe);
|
||||
return $camera.plan_move(dir, strafe);
|
||||
}
|
||||
|
||||
void MainUI::abort_plan() {
|
||||
$camera.abort_plan($rayview);
|
||||
$camera.abort_plan();
|
||||
}
|
||||
|
||||
void MainUI::dead_entity(DinkyECS::Entity entity) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue