aboutsummaryrefslogtreecommitdiff
path: root/inputs/ContinuousLocationInput.py
diff options
context:
space:
mode:
Diffstat (limited to 'inputs/ContinuousLocationInput.py')
-rw-r--r--inputs/ContinuousLocationInput.py19
1 files changed, 19 insertions, 0 deletions
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})
+