Computer Science Canada

help with scrolling off the winidow

Author:  sanzo44 [ Thu Jan 06, 2005 11:46 am ]
Post subject:  help with scrolling off the winidow

I created one big map for my game, instead of a bunch small ones. I don't want to use the scrollbars that the turing window creates but instead use the mouse to scroll. Can anyone help with this?

Author:  Cervantes [ Thu Jan 06, 2005 4:19 pm ]
Post subject: 

Here's an idea for you to play around with. It's not scrollbars, true. You'll have to do that Smile
code:

setscreen ("offscreenonly")
var mx, my, btn : int
for i : 1 .. 100
    drawfilloval (Rand.Int (0, maxx), Rand.Int (0, maxy), 8, 8, cyan)
end for
var picture := Pic.New (0, 0, maxx, maxy)
var picX, picY := 0
loop
    Mouse.Where (mx, my, btn)
    if mx < 50 and btn ~= 0 then
        picX += 1
    end if
    if mx > maxx - 50 and btn ~= 0 then
        picX -= 1
    end if
    if my < 50 and btn ~= 0 then
        picY += 1
    end if
    if my > maxy - 50 and btn ~= 0 then
        picY -= 1
    end if
    cls
    Pic.Draw (picture, picX, picY, picCopy)
    View.Update
    delay (10)
end loop


: