refactor, simplify common access names

This commit is contained in:
Matthieu Jolimaitre 2024-04-10 03:15:01 +02:00
parent f277a71087
commit 55a5adcd92
5 changed files with 30 additions and 20 deletions

View file

@ -16,8 +16,8 @@ export function sys_render_world(center: Vec2, size: Vec2) {
const result = Array.from(range(0, size.y())).map(() => Array.from(range(0, size.x())).map(() => " "));
const min = center.sub(radius);
const max = center.add(radius).sub(v2(1, 1));
for (const [pos, display] of engine.query_all(query_in_rect(min, max).with(CompDisplay))) {
const local_pos = pos.position.sub(min);
for (const [pos, display] of engine.all(query_in_rect(min, max).with(CompDisplay))) {
const local_pos = pos.pos.sub(min);
result[local_pos.y()][local_pos.x()] = display.display;
}
return result.map((line) => line.join("")).toReversed().join("\n");