Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #This is a script for FreePIE (http://andersmalmgren.github.io/FreePIE/)
- #It maps buttons on Wiimote 0 to keys on the keyboard
- #Hopefully, this will help people having trouble making a simple "Wiimote to Keyboard" script
- #I'm releasing this under public domain. I assume there's no problem with that?
- def map_wiimote_to_key(wiimote_index, wiimote_button, key):
- if wiimote[wiimote_index].buttons.button_down(wiimote_button):
- keyboard.setKeyDown(key)
- else:
- keyboard.setKeyUp(key)
- def update():
- #Sideways controls (DPad)
- map_wiimote_to_key(0, WiimoteButtons.DPadRight, Key.UpArrow)
- map_wiimote_to_key(0, WiimoteButtons.DPadLeft, Key.DownArrow)
- map_wiimote_to_key(0, WiimoteButtons.DPadUp, Key.LeftArrow)
- map_wiimote_to_key(0, WiimoteButtons.DPadDown, Key.RightArrow)
- #1 button --> Z key
- map_wiimote_to_key(0, WiimoteButtons.One, Key.Z)
- #2 button --> X key
- map_wiimote_to_key(0, WiimoteButtons.Two, Key.X)
- #- button --> Right shift key
- map_wiimote_to_key(0, WiimoteButtons.Minus, Key.RightShift)
- #+ button --> Enter key
- map_wiimote_to_key(0, WiimoteButtons.Plus, Key.Return)
- if starting:
- wiimote[0].buttons.update += update
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement