added getEventName

This commit is contained in:
Darren Ranalli 2007-09-20 00:00:34 +00:00
parent 14b7dd6d25
commit 41d610f87d

View File

@ -99,6 +99,9 @@ class InputState(DirectObject.DirectObject):
else: else:
return name in self._state return name in self._state
def getEventName(self, name):
return "InputState-%s" % (name,)
def set(self, name, isActive, inputSource=None): def set(self, name, isActive, inputSource=None):
assert self.debugPrint("set(name=%s, isActive=%s, inputSource=%s)"%(name, isActive, inputSource)) assert self.debugPrint("set(name=%s, isActive=%s, inputSource=%s)"%(name, isActive, inputSource))
# inputSource is a string that identifies where this input change # inputSource is a string that identifies where this input change
@ -119,7 +122,7 @@ class InputState(DirectObject.DirectObject):
# We change the name before sending it because this may # We change the name before sending it because this may
# be the same name that messenger used to call InputState.set() # be the same name that messenger used to call InputState.set()
# this avoids running in circles: # this avoids running in circles:
messenger.send("InputState-%s"%(name,), [self.isSet(name)]) messenger.send(self.getEventName(name), [self.isSet(name)])
def releaseInputs(self, name): def releaseInputs(self, name):
# call this to act as if all inputs affecting this state have been released # call this to act as if all inputs affecting this state have been released