Rev and joystick or switch
Randall Lee Reetz
randall at randallreetz.com
Fri Jul 25 19:54:46 EDT 2008
Actually... I just wrote a test project... this code just takes
mouseLoc and converts to vertical motion for a graphic....
on mouseDown
put 0 into TopLim
put (the height of this window) into BotLim
put the loc of cd grc 1 into StrtLoc
put the clickLoc into CL
put (item 1 of StrtLoc)-(item 1 of CL) into HOffSet
put (item 2 of StrtLoc)-(item 2 of CL) into VOffSet
repeat while the mouse is down
put the mouseLoc into NL
if ((item 2 of StrtLoc)-((item 2 of CL)-(item 2 of NL))) > TopLim
then
if ((item 2 of StrtLoc)-((item 2 of CL)-(item 2 of NL))) < BotLim
then
set the loc of cd grc 1 to (item 1 of StrtLoc),((item 2 of StrtLoc)-
((item 2 of CL)-(item 2 of NL)))
else
set the loc of cd grc 1 to (item 1 of StrtLoc),BotLim
end if
else
set the loc of cd grc 1 to (item 1 of StrtLoc),TopLim
end if
end repeat
end mouseDown
... and this code uses a vertical slider button that is set to act
like a joy stick...
on mouseEnter
global BotLim,TopLim
put 0 into TopLim
put (the height of this window) into BotLim
set the minimumValue of me to (-1*((BotLim-TopLim)/10))
set the maximumValue of me to ((BotLim-TopLim)/10)
set the autoHilite of me to true
end mouseEnter
on mouseStillDown
global BotLim,TopLim
put ((the currentValue of me)*-1) into CV -- invert slider value
if ((item 2 of the loc of cd grc 1)+CV)³ TopLim
then
if ((item 2 of the loc of cd grc 1)+ CV)²(the height of this window)
then
set the loc of cd grc 1 to (item 1 of the loc of cd grc 1),((item 2
of the loc of cd grc 1)+CV)
else
set the loc of cd grc 1 to (item 1 of the loc of cd grc 1),BotLim --
bottom limit
end if
else
set the loc of cd grc 1 to (item 1 of the loc of cd grc 1),TopLim --
top limit
end if
end mouseStillDown
on mouseUp
set the currentValue of me to 0 -- reset slider to center
end mouseUp
On Jul 24, 2008, at 1:11 PM, Randall Reetz wrote:
> Or, if the joystick is controlling the mouse, then you just use
> standard mouse events. No need for an intermediate event generator
> like usboverdrive.
>
> -----Original Message-----
> From: "David Glasgow" <david at dvglasgow.wanadoo.co.uk>
> To: use-revolution at lists.runrev.com
> Sent: 7/24/2008 12:29 PM
> Subject: Rev and joystick or switch
>
> I want to use a switch (lever style accessibility gadget) or a very
> simple joystick to enable users to respond to images by pushing away
> or pulling towards themselves. It needs to work on both Mac & PC.
> Fewer buttons the better, and no flash rumbling or stuff like that.
>
> Any suggestions for simple and preferably cheap hardware that folks
> have used with Rev?
>
> best
>
> David Glasgow
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
More information about the use-livecode
mailing list