Ok. How I did a supreme commander style zoom in my 4x space game.
Variables:
* In my game engine, I have an absolute coordinate system for each planet and object.
* I then have a camera object that has a variable that tells me which coordinate should be in the middle of the user's monitor.
* I also have the zoom level as a variable.
* And then there is the mouse's location on the screen.
When the user moves the mouse to the edge, the camera changes it's coordinates and all the objects move on screen according to that variable. aka
Absolute coordinate + Camera Location = Display location
They key is that when you zoom in, and zoom out the location of the mouse must stay the same in the
absolute cordinate system not the display coordinates.
So that means you need logic like this each time the user zooms in and out.
1. Calculate where the mouse is in the absolute coordinate system.
2. zoom in/out.
3. Move the camera so that the mouse will be over the location you calculated in step 1 again.
--------------------------------
If you are asking how I made the zoom rate steady, then.... To do that I used 1.03^(inverse of the zoom) for the zoom speed. aka
Code:
zoomspeed = (float) (1.5 * Math.pow(1.03, z));
And z is the inverse of the zoom. ex: If I was zoomed out where everything was half size, z=2.