
-----------------------------------
waka
Mon Jun 25, 2007 6:29 pm

Manipulating the Mouse
-----------------------------------
I have a program that pans a picture with the mouse and I am trying to figure out the best way to make it keep panning once the mouse hits the side of the screen. Now this is easy to do but it will continue to pan. What I want is to be able to do an endless pan but only pan when I move the mouse so "if MouseX < 0 then pan" won't do the trick. I'm quite sure Turing wont actually reset the mouse position so my question is what would be the easiest way to do an endless pan only on mouse movement. Here is the basic code.

setscreen ("graphics:1280;650,offscreenonly,nocursor,nobuttonbar")
var MouseY, MouseX, MouseButton, BackgroundX, MouseXTemp, MouseYTemp, BackgroundY, PanVert : int
var Background := Pic.FileNew ("Panoramic_Photo3.jpg")
BackgroundY := 0
BackgroundX := 0
MouseX := 0
MouseY := 0
MouseXTemp := 0
MouseYTemp := 0
loop
    cls
    Pic.Draw (Background, BackgroundX, BackgroundY, picCopy)
    Mouse.Where (MouseX, MouseY, MouseButton)
    if MouseX > MouseXTemp then
        PanVert := MouseX - MouseXTemp
        BackgroundX := BackgroundX - PanVert
    end if
    if MouseX < MouseXTemp then
        PanVert := MouseXTemp - MouseX
        BackgroundX := BackgroundX + PanVert
    end if
    MouseXTemp := MouseX
    MouseYTemp := MouseY
    View.Update
end loop
[/b]

-----------------------------------
Saad
Mon Jun 25, 2007 7:52 pm

Re: Manipulating the Mouse
-----------------------------------
That is not possible with turing i think, but you can create a simple program to do that in another language.

You could make it move when it clicks so that the player can move his mouse back to where he wants and then click and rotates

-----------------------------------
Auraiken
Tue Jun 26, 2007 5:08 pm

Re: Manipulating the Mouse
-----------------------------------
It's possible. Requires a bit of math. You'll need to create two pictures. One to be your first image that you can pan with. Second to connect the one picture with the first once you reach the end of the first. you can free the image once it is off screen and create a new one when you need to.

Also you should have the mouse offset by half the width of the window. So you aren't halfway through the pic when you are in the middle of the window.

Turing gets it's mouse position relative to the window.

if i have time i'll work out something like it.

-----------------------------------
Saad
Tue Jun 26, 2007 5:41 pm

Re: Manipulating the Mouse
-----------------------------------
Ahh read the question wrong

All you need to do is compare your last x coordinate with your current x coordinate, if they arent equal then youve moved.

-----------------------------------
waka
Sun Jul 08, 2007 9:20 pm

Re: Manipulating the Mouse
-----------------------------------
I think you've read my code and question wrong, I have already done the mouse panning I just cant get the picture to keep panning once my mouse has hit a side. (and the picture only pans on mouse movement so if the mouse is < 0 then pan wont work)


Thanks Auraiken, if you do find a solution I'd appreciate it.

-----------------------------------
Nick
Wed Aug 15, 2007 5:49 am

RE:Manipulating the Mouse
-----------------------------------
u could make a if MouseX