Only render tiles in camera view
This commit is contained in:
@@ -21,10 +21,10 @@ main :: proc() {
|
||||
TILEMAP_TILE_SIZE,
|
||||
TILEMAP_TILE_SIZE,
|
||||
)
|
||||
grid = create_tile_grid(300, 300)
|
||||
grid = create_tile_grid(1500, 1500)
|
||||
|
||||
player = {
|
||||
position = {20, 20},
|
||||
position = {1500, 500},
|
||||
camera = {
|
||||
zoom = 4,
|
||||
offset = {f32(raylib.GetScreenWidth()) / 2, f32(raylib.GetScreenHeight()) / 2},
|
||||
@@ -66,7 +66,7 @@ update :: proc(delta: f32) {
|
||||
|
||||
@(private = "file")
|
||||
draw :: proc() {
|
||||
draw_tile_grid(&tilemap_sheet, grid)
|
||||
draw_tile_grid(&tilemap_sheet, grid, &player.camera)
|
||||
draw_player(&player)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user