Minor Tetzle update
December 22, 2008 3 Comments
I made a release of Tetzle yesterday that fixes two long-standing bugs: firstly, the mouse cursor should no longer drift off of pieces while you are moving them; secondly, the tiles should look correct no matter how zoomed the board is. Both bugs stem from the same issue: the width of the tiles don’t evenly divide, and floating point errors were cropping in.
For instance, if you have a tile that is 64 pixels wide and you want to show it as 6 pixels wide, you multiply it by 0.09375. But if the tile is 65 pixels wide, you need to multiply it by a number that can’t be properly represented as a float. And so most of the tiles will show up as 6 pixels, but some of them will be 7 and stretch the tile border to match. My quick solution was to scale the tiles on the CPU and round the values to integers before passing them to OpenGL. For the 1.3 release I plan to use a faster solution, but I wanted to release a stop-gap bugfix before then.