Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to ask how would I go about using the mouse to zoom in and out of my current isometric tiled map, not only that but I would like the tiles to be in the center of the view when the application has started.

This is what I get so far: Screenshot

share|improve this question
We'll need more info to help you. Are you using OpenGL? Something else? And have you searched for a similar question? I imagine this has been covered before. – stephelton Nov 28 '11 at 2:31
@stephelton - Seeing that it's running on Java, I'm going to make an assumption that it is indeed OpenGL. to user - We can't help you if we don't know how your camera is set up, etc. – DMan Nov 28 '11 at 4:59
I'm using Java but the basic java libraries I am using drawImage() to render my images on screen and I haven't got a camera set up but I'd like to know how to do so. – user1048606 Nov 28 '11 at 14:19

I would suggest you start with some tutorials on setting up the model-view and projection matrices in OpenGL. You'll find plenty of these on Google, as I did. Once you have this down, you may find it convenient to create a Camera class to handle this logic.

From there, you'll handle the mouse input (scroll wheel?) and use it to tell your camera to zoom in and out. Zoom probably means moving (translating) your camera "in" and "out" of the scene, but it could also mean scale or even messing with field of view.

share|improve this answer
Is there no way to do this using the basic Java libraries? – user1048606 Nov 28 '11 at 17:26
I'm sorry, I misread DMan's comment as yours. So you are using the java awt package then? I expect you'd need to keep up with the scale and offset yourself and incorporate that into the destination when you call drawImage(). If someone doesn't beat me to it, I might help you with the logic when I have some time. – stephelton Nov 28 '11 at 20:25
I've found a way to center my isometric grid but I don't have a working camera or an idea of how to implement one. I used the awt method translate() before I rendered my images. What I really want is to let teh player be able to pan left, right, up and down. While also letting them zoom in and out by holding down the left mouse button and scrolling up to zoom in. – user1048606 Nov 28 '11 at 23:21
SCREENSHOT – user1048606 Nov 28 '11 at 23:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.