Showing posts with label glovepie. Show all posts
Showing posts with label glovepie. Show all posts

Wednesday, March 2, 2011

GlovePIE Script for simple touchpad gestures

GlovePIE only understands Synaptics touchpads, which means the external one we purchased isn't compatible. At least for PC's, most laptop touchpads are Synaptics and my beautiful script works nicely :) Copy and paste to GlovePIE and enjoy typing different letters by moving your finger in four directions:


Touchpad.swallow = true // Touchpad will have no effect on cursor

// This script is about making simple touchpad gestures produce keystrokes.

If Touchpad.FingerPresent = true then
var.touchlocx = touchpad.x
var.touchlocy = touchpad.y
wait 20 ms
If touchpad.x > (var.touchlocx + 0.05) then // Move finger right
Press K
Release K
ElseIf touchpad.x < (var.touchlocx - 0.05) then // Move finger left
Press J
Release J
ElseIf touchpad.y < (var.touchlocy - 0.05) then // Move finger up
Press U
Release U
ElseIf touchpad.y > (var.touchlocy + 0.05) then // Move finger down
Press I
Release I
EndIf
EndIF

Tuesday, February 15, 2011

GlovePIE code

// Nunchuck accelerometers for movements

var.xNunchuk = 0
var.yNunchuk = 0

a = Wiimote.Nunchuk.Roll + var.xNunchuk < -40
d = Wiimote.Nunchuk.Roll + var.xNunchuk > 40
w = Wiimote.Nunchuk.Pitch + var.yNunchuk < -20
s = Wiimote.Nunchuk.Pitch + var.yNunchuk > 20


// Relative positioning mouse


if wiimote.PointerVisible then
if abs(wiimote.PointerX - var.prevX) + abs(wiimote.PointerY - var.prevY) < 0.1
mouse.x += (wiimote.PointerX - var.prevX) /1
mouse.y += (wiimote.PointerY - var.prevY)*(-1) /1
endif
endif

var.prevX = wiimote.PointerX
var.prevY = wiimote.PointerY