Computer Science Canada

Mouse.ButtonWait ... difficult to implement?

Author:  Piro24 [ Wed Jan 10, 2007 3:55 pm ]
Post subject:  Mouse.ButtonWait ... difficult to implement?

My game uses Mouse.ButtonWait to get input from the user. It works well initially, but when I add other loops to my main program, it takes in the value of every click and outputs them when it reaches the loop.

For example, if I were to use Mouse.Where to detect whether something was clicked or not, (IE a button like 'Start' which would proceed to the game), the button will register as clicked but it will also register Mouse.ButtonWait as being down, which I don't want.

Here's an example.

code:
    var x, y, b, b2 : int

var displayCheck : boolean := false

loop
    Mouse.Where (x, y, b)
    drawfillbox (10, 10, 250, 250, black)
    if b = 1 and x > 10 and x < 250 and y > 10 and y < 250 then
        exit
    end if
end loop
x := 0
y := 0
b := 0
cls
loop
    if displayCheck = true then
        Mouse.ButtonWait ("down", x, y, b, b2)
        Draw.FillOval (x, y, 23, 23, black)
    end if
end loop


When the user is in the first loop, I want them to be able to click but not have it register in the Mouse.ButtonWait function..

So in conclusion is there a way to make the mouse usuable in the program without being registered in the Mouse.ButtonWait function until I'd like it to...?

Author:  Clayton [ Wed Jan 10, 2007 6:17 pm ]
Post subject:  Re: Mouse.ButtonWait ... difficult to implement?

you might want to try looking at the source for my button class here.


: