aboutsummaryrefslogtreecommitdiff
path: root/inputs/PygameInput.py
diff options
context:
space:
mode:
authorGravatar Russell Cohen <rcoh@mit.edu>2010-11-24 01:09:12 -0500
committerGravatar Russell Cohen <rcoh@mit.edu>2010-11-24 01:09:12 -0500
commitb042647b68abdc82490ca6e059993b8eba28904c (patch)
treea9ee95a38e98b377c251b7b2e9af9cbd8056cf7c /inputs/PygameInput.py
parent407ac922fc4178021cf3a16dfb1bd875b6083ac4 (diff)
Refactoring complete! Made modules/packages as appropriate. Finally.
Diffstat (limited to 'inputs/PygameInput.py')
-rw-r--r--inputs/PygameInput.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/inputs/PygameInput.py b/inputs/PygameInput.py
new file mode 100644
index 0000000..6c84664
--- /dev/null
+++ b/inputs/PygameInput.py
@@ -0,0 +1,17 @@
+import time, Util
+from operationscore.Input import *
+import pygame
+from pygame.locals import *
+#This class processes input from an already running pygame instance and passes
+#it to the parent. This class requires an already running pygame instance.
+class PygameInput(Input):
+ def sensingLoop(self):
+ #try:
+ for event in pygame.event.get():
+ if event.type is KEYDOWN:
+ self.respond({Util.location: (5,5),'Key': event.key})
+ if event.type is MOUSEBUTTONDOWN:
+ self.respond({Util.location: pygame.mouse.get_pos()})
+ #except:
+ #raise Exception('Pygame not initialized. Pygame must be \
+ #initialized.')