Does anyone know how to calculate the aspect ratio (formula) ?um...width / height
16 pixel width, 9 pixel height -> aspect ratio = 16 / 9 = 1.77~ (or 1.77~:1)
32 pixel width, 24 pixel height -> aspect ratio = 32 / 24 = 1.33~ (or 1.33~:1)
Real life example:
You want 5x5 blocks. Display size is 640x480.
-> Aspect ratio 640 / 480 = 1.33~
-> 480 / 5 = 96
-> 96 * 1.33~ = 128
-> block size = 128x96
The shorter way is of course to just divide width and height by the number of blocks per row and column. EDIT: Ups, that's just what you do!
EDIT2: Or do you mean, you want the integer aspect ratio, as are seen on descriptions for monitor resolutions etc. (e.g. 4:3, 16:9, ...)? In case you do, this is done by calculating the greatest common divisor of both, width and height. Try the demo capx, it uses a recursive function to calculate the gcd: integer aspect ratio