From 7a4f06d15b0fe9bd22996af6a1ca2c3ca5ca3e3f Mon Sep 17 00:00:00 2001 From: dxiao Date: Sun, 13 Feb 2011 19:00:44 -0500 Subject: Added a vertical bars animation to C5Sign-dxiao --- inputs/ContinuousLocationInput.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 inputs/ContinuousLocationInput.py (limited to 'inputs') diff --git a/inputs/ContinuousLocationInput.py b/inputs/ContinuousLocationInput.py new file mode 100644 index 0000000..f39bd9b --- /dev/null +++ b/inputs/ContinuousLocationInput.py @@ -0,0 +1,19 @@ +import util.TimeOps as clock +import util.ComponentRegistry as compReg +import util.Strings as Strings +from operationscore.Input import * +class ContinuousLocationInput(Input): + '''Continuously returns one of nine positions on the screen as specified by the xloc + and yloc arguments, which can take values 'min', 'max', and 'center'. ''' + def inputInit(self): + xvals = {} + yvals = {} + xvals['left'], yvals['bottom'], xvals['right'], yvals['top'] = compReg.getComponent('Screen').getSize() + (xvals['center'], yvals['center']) = ((xvals['left']+xvals['right']) / 2, (yvals['top']+yvals['bottom']) / 2) + + self.location = (xvals[self['xloc']], yvals[self['yloc']]) + + def sensingLoop(self): + print (self.location) + self.respond({Strings.LOCATION: self.location}) + -- cgit v1.2.3