aboutsummaryrefslogtreecommitdiff
path: root/inputs/ContinuousLocationInput.py
blob: 52a36adf51c8669f06b15d45de370eb394963fbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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):
        self.respond({Strings.LOCATION: self.location})