make sure there's an odd number of tiles

This commit is contained in:
zapashcanon 2022-12-08 03:08:49 +01:00
parent ddeba99f2e
commit 365c558f35
Signed by untrusted user who does not match committer: zapashcanon
GPG Key ID: 8981C3C62D1D28F1

View File

@ -54,9 +54,13 @@ let init () =
C2d.fill_rect context ~x:0. ~y:0. ~w:(float_of_int width)
~h:(float_of_int height)
let tiles_per_w = width / tile_size
let tiles_per_w =
let n = width / tile_size in
if n mod 2 = 0 then n - 1 else n
let tiles_per_h = height / tile_size
let tiles_per_h =
let n = height / tile_size in
if n mod 2 = 0 then n - 1 else n
let orig_x = (width - (tiles_per_w * tile_size)) / 2