Dynamically load/unload chunks around player
This commit is contained in:
@@ -152,18 +152,12 @@ generate_chunk :: proc(pos:Vec2i) -> Chunk {
|
||||
|
||||
for x in 0..<CHUNK_SIZE {
|
||||
for y in 0..<CHUNK_SIZE {
|
||||
chunk.tiles[x][y] = Tile {
|
||||
type = .NOTHING,
|
||||
tilemap_pos = {0,0},
|
||||
interaction = .NOTHING,
|
||||
resource = .NOTHING,
|
||||
color = {0,0,0,255}
|
||||
}
|
||||
chunk.tiles[x][y] = nothing_tile
|
||||
}
|
||||
}
|
||||
|
||||
center_pos := Vec2i{CHUNK_SIZE/2, CHUNK_SIZE/2}
|
||||
// set_chunk_tile(&chunk, tree_tile, center_pos)
|
||||
set_chunk_tile(&chunk, tree_tile, center_pos)
|
||||
|
||||
return chunk
|
||||
}
|
||||
@@ -234,18 +228,3 @@ draw_world :: proc(w:^World) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// draw_world :: proc(w:^World) {
|
||||
// for x in 0..< len(w.grid) {
|
||||
// for y in 0..< len(w.grid) {
|
||||
// tile := w.grid[x][y]
|
||||
// posX := x * TILE_SIZE
|
||||
// posY := y * TILE_SIZE
|
||||
|
||||
// if tile.type != .NOTHING {
|
||||
// draw_tile(tile.tilemap_pos, {f32(posX), f32(posY)}, tile.color)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user