I'm working on a game where there are a bunch of rectangles with x width & height in a grid of x width and height, where one rectangle is different in color from the others, and one has to guess which one it is. The rectangles should scale with the grid size and also the view size. I currently have a half working system, but it's not good enough since it doesn't always scale as much as it could. Here's an example of my game: http://i.imgur.com/Zi4yYG8.png Here's an example of where it could have scaled better: http://i.imgur.com/ui7god4.png What would the formula be for doing this? Would the formula use the views width & height and the grids width & height to somehow figure out the rectangles size? The way I have setup the code is like this:
if(randomGridWidth > randomGridHeight){rectom = new Rect(0, 0, getWidth() / randomGridWidth, getWidth() / randomGridWidth);}else{rectom = new Rect(0, 0, getHeight() / randomGridHeight, getHeight() / randomGridHeight);}
Note that this is not the same code as was used when I took the screenshots. I'm currently using the formula above and it's still not scaling well enough (it's even smaller now). I'd really like to hear your opinions and ideas because everything I try fails somewhat (not very good at math).
EDIT: If you need more code, simply ask