Moving Cursor /w Zoom and Scroll
BlitzMax Forums/BlitzMax Programming/Moving Cursor /w Zoom and Scroll
| ||
***Double Post*** |
| ||
Hello, Can someone help me fix this? I'm trying to capture the location of an tile that has been moved and zoomed... Here is me prototype of what I'm trying to do, as you can see the cursor isn't lining up :( ** UPDATED THE CODE A BIT, BUT STILL DOESN'T WORK ** |
| ||
I think, it is like this:Method GetTile:TMap(nx:Float Var, ny:Float Var, tx:Int, ty:Int) nx = tx/Self.zoom-Self.X ny = ty/Self.zoom-Self.Y End Method |
| ||
Tried that, it doesn't work.. :( :UPDATED: So I tried a few other things, Distance formulas which seem to work, but would like to have another option for displaying the cursor along the tile being selected. |
| ||
The function is working... Additional I would suggest not to work with two offset systems like "Self.X" and "GraphicsWidth()/2". Self.X alone is enough to do the job. Cls m.Render() m.GetTile(orgx, orgy, MouseX(), MouseY() ) SetColor 255,0,0 DrawText "X=" + orgx + " Y= " + orgy,100,100 Flip 0 Do you know, that you do not need all this "Self" inside Methods? See my version of SetZoom() function... Method SetZoom(v:Float) zoom :+ v If zoom < 0.5 zoom = 0.5 ElseIf zoom > 5.0 zoom = 5.0 EndIf End Method |
| ||
Thank you so much for helping me out wit this.. I was pulling my hair out, I was getting their and then the zoom kept messing me up.. And Yes LOL .. I know I don't need all the selfs, My OCD kicks in and then I have to start adding them.. Once again thank you for all your help on this.. BTW the 2nd offset is to make up for the centering, I was trying to correct it so it zooms into the center of the screen Regards, FBEpyon |