summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <davet@gnu.org>2019-05-08 17:26:20 -0400
committerDavid Thompson <davet@gnu.org>2019-05-08 17:26:20 -0400
commit0ac439451258e86d9e2fce3a0e45cb41111018aa (patch)
tree1d40b6b69f6576cec7e1b046d694a0a79f91c08e
parent3503ad80dc8f1233a4502540d22196f59b6b93ec (diff)
texture: tileset: Fix rows/columns calculation.
* chickadee/render/texture.scm (split-texture): Use ceiling instead of floor when computing number of rows and columns.
-rw-r--r--chickadee/render/texture.scm4
1 files changed, 2 insertions, 2 deletions
diff --git a/chickadee/render/texture.scm b/chickadee/render/texture.scm
index f225770..40d8fa8 100644
--- a/chickadee/render/texture.scm
+++ b/chickadee/render/texture.scm
@@ -313,8 +313,8 @@ This type of texture atlas layout is very common for tile map
terrain."
(let* ((w (texture-width texture))
(h (texture-height texture))
- (rows (inexact->exact (floor (/ (- h margin) (+ tile-height spacing)))))
- (columns (inexact->exact (floor (/ (- w margin) (+ tile-width spacing)))))
+ (rows (inexact->exact (ceiling (/ (- h margin) (+ tile-height spacing)))))
+ (columns (inexact->exact (ceiling (/ (- w margin) (+ tile-width spacing)))))
(v (make-vector (* rows columns))))
(define (make-tile tx ty)
(let* ((x (+ (* tx (+ tile-width spacing)) margin))