From cb69d2e1c7ced951cbf7a31ee286b0ed92cab8a8 Mon Sep 17 00:00:00 2001 From: rcoh Date: Fri, 18 Feb 2011 16:56:43 -0500 Subject: Adding Epydoc generated docs. --- html/SmootLight.inputs.PygameInput-pysrc.html | 160 ++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 html/SmootLight.inputs.PygameInput-pysrc.html (limited to 'html/SmootLight.inputs.PygameInput-pysrc.html') diff --git a/html/SmootLight.inputs.PygameInput-pysrc.html b/html/SmootLight.inputs.PygameInput-pysrc.html new file mode 100644 index 0000000..dafcbff --- /dev/null +++ b/html/SmootLight.inputs.PygameInput-pysrc.html @@ -0,0 +1,160 @@ + + + + + SmootLight.inputs.PygameInput + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + Package SmootLight :: + Package inputs :: + Module PygameInput + + + + + + +
[hide private]
[frames] | no frames]
+
+

Source Code for Module SmootLight.inputs.PygameInput

+
+ 1  import time 
+ 2  import util.Strings as Strings 
+ 3  from operationscore.Input import * 
+ 4  import pygame 
+ 5  from pygame.locals import * 
+ 6  #This class processes input from an already running pygame instance and passes 
+ 7  #it to the parent.  This class requires an already running pygame instance. 
+
8 -class PygameInput(Input): +
9 """PygameInput is an input tied to the PygameDisplay. Specify: +10 <FollowMouse>True</FollowMouse> to receive an input every frame specifying the current mouse +11 position. +12 <Keyboard>True</Keyboard> to grab keystrokes +13 <Clicks>True</Clicks> to grab clicks. +14 +15 NB: If follow mouse is enabled, PygameInput will not return mouse and keypresses. You can, however, +16 instantiate other PygameInputs in the XML that will capture mouse and keypresses.""" +
17 - def sensingLoop(self): +
18 if 'Scale' in self: +19 scale = self['Scale'] +20 else: +21 scale = 1 +22 if self['FollowMouse']: +23 self.respond({Strings.LOCATION: pygame.mouse.get_pos()}) +24 return +25 for event in pygame.event.get(): +26 if event.type is KEYDOWN: +27 if event.key == 27: +28 self.die() +29 if self['Keyboard']: +30 try: +31 self.respond({'Key': event.key, 'KeyChar': chr(event.key)}) +32 except: +33 self.respond({'Key': event.key}) +34 return +35 else: +36 pygame.event.post(event) +37 if event.type is MOUSEBUTTONDOWN: +38 if self['Clicks']: +39 self.respond({Strings.LOCATION: pygame.mouse.get_pos()}) +40 else: +41 pygame.event.post(event) +
42 +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
+ + + + -- cgit v1.2.3