blob: 72ca8f042bd005f40634ca9092730bd670886fe2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
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 = {}
compReg.getLock().acquire()
xvals['left'], yvals['bottom'], xvals['right'], yvals['top'] = compReg.getComponent('Screen').getSize()
compReg.getLock().release()
(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):
self.respond({Strings.LOCATION: self.location})
|