diff options
Diffstat (limited to 'camera.lua')
| -rw-r--r-- | camera.lua | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -3,7 +3,7 @@ SCREEN = vec2(128, 128) _chunk_size = vec2(100, 100) _chunk_size:apply(function (v) assert(v % 2 == 0) end) _padding = (SCREEN - _chunk_size) / 2 -_interpolate_step = 20 +_interpolate_step = 22 assert(_chunk_size.x < SCREEN.x and _chunk_size.y < SCREEN.y) Camera = {} @@ -39,8 +39,13 @@ function from_chunk(chunk) return chunk * _chunk_size end +_cull_factor = 1/4 function Camera:render(entity) screen_position = (entity.sprite_position or entity.position) - self.position + if not screen_position:in_bounds(SCREEN * -_cull_factor, SCREEN * (1 + _cull_factor)) then + return + end + entity:render(screen_position) end |
