aboutsummaryrefslogtreecommitdiff
path: root/inputs/InitialLocationInput.py
diff options
context:
space:
mode:
Diffstat (limited to 'inputs/InitialLocationInput.py')
-rw-r--r--inputs/InitialLocationInput.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/inputs/InitialLocationInput.py b/inputs/InitialLocationInput.py
new file mode 100644
index 0000000..8d39a40
--- /dev/null
+++ b/inputs/InitialLocationInput.py
@@ -0,0 +1,24 @@
+import util.TimeOps as clock
+import util.ComponentRegistry as compReg
+import util.Strings as Strings
+from operationscore.Input import *
+class InitialLocationInput(Input):
+ """Takes two arguments: xPos, yPos, where xPos and yPos is a value from
+ 0 to 1, where 0 represents top/left and 1 represents bottom/right of the
+ lightscreen. Will return that position on the screen only once."""
+
+ def inputInit(self):
+ compReg.getLock().acquire()
+ xmin, ymin, xmax, ymax = compReg.getComponent('Screen').getSize()
+ compReg.getLock().release()
+
+ xlen = xmax-xmin
+ ylen = ymax-ymin
+
+ self.xloc = xmin + xlen * self['xPos']
+ self.yloc = ymin + ylen * self['yPos']
+
+ def sensingLoop(self):
+ self.respond({Strings.LOCATION: (self.xloc, self.yloc)})
+ self.done = True
+