Finally can pick things up, but it's really bad so far. Need a bunch of refactoring in how the collision system works, and make it so collision and maps can have multiple entities in the same square.
This commit is contained in:
parent
2458f01ebd
commit
2aa4f0a2e8
13 changed files with 78 additions and 43 deletions
|
@ -31,14 +31,18 @@ namespace gui {
|
|||
$overlay_ui.init();
|
||||
}
|
||||
|
||||
void MainUI::render() {
|
||||
DinkyECS::Entity MainUI::camera_aim() {
|
||||
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($level.collision->occupied(aimed_at)) {
|
||||
return $level.collision->get(aimed_at);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void MainUI::render() {
|
||||
$rayview.aiming_at = camera_aim();
|
||||
if($needs_render) $rayview.render();
|
||||
$rayview.draw($window);
|
||||
|
||||
|
@ -64,7 +68,6 @@ namespace gui {
|
|||
size_t($camera.target_x),
|
||||
size_t($camera.target_y)};
|
||||
return std::make_optional<Point>(pos);
|
||||
|
||||
} else {
|
||||
$needs_render = true;
|
||||
return std::nullopt;
|
||||
|
@ -101,6 +104,7 @@ namespace gui {
|
|||
|
||||
$compass_dir = 0;
|
||||
|
||||
$overlay_ui.update_level(level);
|
||||
dirty();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue