Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --------------------------------------------------------------
- -- KEY INPUT LIBRARY -----------------------------------------
- local storyboard = require( "storyboard" )
- local socket = require('socket')
- local class = {}
- --------------------------------------------------------------
- -- FUNCTIONS -------------------------------------------------
- function class.initialise()
- local udp = socket.udp()
- udp:setsockname('127.0.0.1', 5000)
- udp:settimeout(0.001)
- local char, ip, port
- timer.performWithDelay(
- 200,
- function ()
- char, ip, port = udp:receivefrom()
- print( "OI", char, ip, port, "blah" )
- if char then
- local scene = storyboard.getScene( storyboard.getCurrentSceneName() )
- if type( scene.keyboardPressed ) == 'function' then scene:keyboardPressed( char ) ; end
- end
- end,
- 0
- )
- end
- --------------------------------------------------------------
- -- RETURN CLASS DEFINITION -----------------------------------
- return class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement