Try checking this out:
global sw = 800
global sh = 600
global zoomFactor = 10
set display mode sw, sh, 32, 1
sync on
sync rate 60
do
cls
mZ = mousemoveZ()
if mZ > 0 then inc zoomFactor
if mZ < 0 && zoomFactor > 1 then dec zoomFactor
drawGraph()
sync
loop
end
function drawgraph()
ink rgb(100,100,100),0
for x = 1 to sw step zoomFactor
line x, 0, x, sh
next x
for y = 1 to sh step zoomFactor
line 0, y, sw, y
next y
ink rgb(255,255,255),0
for x = 1 to sw step zoomFactor*10
line x, 0, x, sh
next x
for y = 1 to sh step zoomFactor*10
line 0, y, sw, y
next y
endfunction
And here it is with data on it.:
global sw = 800
global sh = 600
global zoomFactor = 10
set display mode sw, sh, 32, 1
sync on
sync rate 60
do
cls
mX = mouseX()
mY = mouseY()
mZ = mousemoveZ()
if mZ > 0 then inc zoomFactor
if mZ < 0 && zoomFactor > 1 then dec zoomFactor
drawGraph()
drawScreenCoord(mX, mY)
sync
loop
end
function drawgraph()
ink rgb(100,100,100),0
for x = 0 to sw step zoomFactor
line x, 0, x, sh
next x
for y = 0 to sh step zoomFactor
line 0, y, sw, y
next y
ink rgb(255,255,255),0
for x = 0 to sw step zoomFactor*10
line x, 0, x, sh
next x
for y = 0 to sh step zoomFactor*10
line 0, y, sw, y
next y
xVal = 0
yVal = 0
for x = 0 to sw-30 step zoomFactor*10
set cursor x,0: print xVal
inc xVal, 10
next x
for y = 0 to sh step zoomFactor*10
if y > 9 && y < sh - 60
set cursor 0, y: print yVal
endif
inc yVal, 10
next x
endfunction
function drawScreenCoord(imX, imY)
set cursor 20,20: print "Mouse X: ", imX
set cursor 20,40: print "Mouse Y: ", imY
set cursor 20,60: print "Grid X: ", (imX / zoomFactor) + 1
set cursor 20,80: print "Grid Y: ", (imY / zoomFactor) + 1
endfunction
Use the mouse wheel to zoom in and out. I didn't comment it or anything, but it should be fairly straight forward. Maybe you are looking for something like this?
Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its whole life believing that it is stupid.