Need help with zoom!

Community Forums/Monkey Talk/Need help with zoom!

SLotman(Posted 2013) [#1]
I'm trying to zoom where the player clicks on a small part of the screen (a 600x600 area) - but for the life of me, I can't figure it out how to do it properly!

Not only it needs to zoom in around where the player clicks, but it shouldn't show "black borders", so the visible area shouldn't scroll outside it's dimensions.

Here's what I have:



If you click on the upper-left corner, the zoom behaves as expected. Anywhere else, it "jumps" around and behaves erratically.

I'm 2 days trying to figure this out, without success... can anyone help me out?

Edit: Changed the code a bit - it's almost working now, just some squares that have some strange movement when zooming in...

Last edited 2013


shinkiro1(Posted 2013) [#2]
Just a tip: You use Scale 1, 1 and Translate 0, 0 after you have popped the matrix which is not necessary. PopMatrix() will reset all Scale, Translate and Rotate commands to the state where it was when you called PushMatrix().