How did floating point numbers get into this? Pixels and mouse coordinates are all integers.
Let's say you start with x = mousex(), which happens to be 170.
tilex = x/64
tilex is now 2 because any remainder is discarded.
There are thus 2 whole tiles to left. How far are you into the current tile?
offsetx = x - tilex*64
This subtracts off the two tiles to the left, leaving 170-128 = 42.
Let's say you start with x = mousex(), which happens to be 170.
tilex = x/64
tilex is now 2 because any remainder is discarded.
There are thus 2 whole tiles to left. How far are you into the current tile?
offsetx = x - tilex*64
This subtracts off the two tiles to the left, leaving 170-128 = 42.