diff options
Diffstat (limited to 'inputs')
-rw-r--r-- | inputs/PygameInput.py | 7 | ||||
-rw-r--r-- | inputs/TCPInput.py | 3 |
2 files changed, 6 insertions, 4 deletions
diff --git a/inputs/PygameInput.py b/inputs/PygameInput.py index 1f438d6..f69d0f5 100644 --- a/inputs/PygameInput.py +++ b/inputs/PygameInput.py @@ -1,4 +1,5 @@ import time, Util +import util.Strings as Strings from operationscore.Input import * import pygame from pygame.locals import * @@ -8,13 +9,13 @@ class PygameInput(Input): def sensingLoop(self): #try: if self['FollowMouse']: - self.respond({Util.location: pygame.mouse.get_pos()}) + self.respond({Strings.LOCATION: pygame.mouse.get_pos()}) return for event in pygame.event.get(): if event.type is KEYDOWN: - self.respond({Util.location: (5,5),'Key': event.key}) + self.respond({Strings.LOCATION: (5,5),'Key': event.key}) if event.type is MOUSEBUTTONDOWN: - self.respond({Util.location: pygame.mouse.get_pos()}) + self.respond({Strings.LOCATION: pygame.mouse.get_pos()}) #except: #raise Exception('Pygame not initialized. Pygame must be \ #initialized.') diff --git a/inputs/TCPInput.py b/inputs/TCPInput.py index acd6243..9f62825 100644 --- a/inputs/TCPInput.py +++ b/inputs/TCPInput.py @@ -1,4 +1,5 @@ import Util +import util.Strings as Strings from operationscore.Input import * import socket, json, time class TCPInput(Input): @@ -25,7 +26,7 @@ class TCPInput(Input): if self.IS_RESPONDING == 1: # if 'responding', respond to the received data dataDict = json.loads(data) # socketDict = {'data':dataDict, 'address':self.address} - socketDict = {Util.location: (100 * (1 - dataDict['x'] / 10), 25 * (1 + dataDict['y'] / 10))} # like PygameInput + socketDict = {Strings.LOCATION: (100 * (1 - dataDict['x'] / 10), 25 * (1 + dataDict['y'] / 10))} # like PygameInput self.respond(socketDict) else: |