Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Mouse commands with a procedure
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
HaVoC




PostPosted: Thu Dec 18, 2003 2:12 pm   Post subject: Mouse commands with a procedure

Is it possible to call a procedure and have it able to be used with a mouse. Like
code:

proc button
drawbox (x,y,x,y,black)
end button

button


Is it possible to make that clickable and give an output. And say I can add two button outputs together.
button = 1
buttonw = 2
result = 1 and 2(not 1+2)
result= 12 not 3
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Thu Dec 18, 2003 5:59 pm   Post subject: (No subject)

you can use mousewhere for this:

mousewhere (var x, y, button : int)

it puts the x an y values of the mouse in to the 1st 2 varibles you put in and the condition of the button in the 3rd.

Ex form the turing doc:

code:

var x, y, button : int
loop
    mousewhere (x, y, button)
    locate (1, 1)
    if button = 0 then
        put x : 4, "  ", y : 4, "  button up"
    else
        put x : 4, "  ", y : 4, "  button down"
    end if
end loop


now to tell if they clicked on your botton you whould uses consion dection with the x and y values of the mouse withch only activates when the mouse botton is down.

there is more info on collsion dection in the turing tuttorial section.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: