mirror of
https://github.com/Noratrieb/game-wip-dontplay.git
synced 2026-01-16 12:25:02 +01:00
Take into account negative coords in chunk offset calculations
This commit is contained in:
parent
49c47ac718
commit
38699c9d09
2 changed files with 46 additions and 8 deletions
|
|
@ -25,8 +25,8 @@ impl GameState {
|
|||
}
|
||||
|
||||
fn for_each_tile(camera_offset: WorldPos, mut f: impl FnMut(TilePos, ScreenPos)) {
|
||||
for y in (0..NATIVE_RESOLUTION.h).step_by(32) {
|
||||
for x in (0..NATIVE_RESOLUTION.w).step_by(32) {
|
||||
for y in (-32..NATIVE_RESOLUTION.h + 32).step_by(32) {
|
||||
for x in (-32..NATIVE_RESOLUTION.w + 32).step_by(32) {
|
||||
f(
|
||||
TilePos {
|
||||
x: (camera_offset.x + x as i32) / 32,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue