|
Panda3D
|
Public Member Functions | |
| def | __init__ |
| def | debugPrint |
| def | delete |
| def | force |
| def | getEventName |
| def | isSet |
| def | releaseInputs |
| def | set |
| def | watch |
| def | watchWithModifiers |
Static Public Attributes | |
| string | ArrowKeys = 'ArrowKeys' |
| string | Keyboard = 'Keyboard' |
| string | Mouse = 'Mouse' |
| tuple | notify = DirectNotifyGlobal.directNotify.newCategory("InputState") |
| string | QE = 'QE' |
| string | WASD = 'WASD' |
InputState is for tracking the on/off state of some events. The initial usage is to watch some keyboard keys so that another task can poll the key states. By the way, in general polling is not a good idea, but it is useful in some situations. Know when to use it:) If in doubt, don't use this class and listen for events instead.
| def __init__ | ( | self | ) |
| def debugPrint | ( | self, | |
| message | |||
| ) |
for debugging
| def delete | ( | self | ) |
| def force | ( | self, | |
| name, | |||
| value, | |||
| inputSource | |||
| ) |
Force isSet(name) to return 'value'.
This returns a token; hold onto the token and call token.release() when you
no longer want to force the state.
example:
# set up
token=inputState.force('forward', True, inputSource='myForwardForcer')
...
# tear down
token.release()
| def getEventName | ( | self, | |
| name | |||
| ) |
| def isSet | ( | self, | |
| name, | |||
inputSource = None |
|||
| ) |
returns True/False
| def releaseInputs | ( | self, | |
| name | |||
| ) |
| def set | ( | self, | |
| name, | |||
| isActive, | |||
inputSource = None |
|||
| ) |
| def watch | ( | self, | |
| name, | |||
| eventOn, | |||
| eventOff, | |||
startState = False, |
|||
inputSource = None |
|||
| ) |
This returns a token; hold onto the token and call token.release() when you
no longer want to watch for these events.
# set up
token = inputState.watch('forward', 'w', 'w-up', inputSource=inputState.WASD)
...
# tear down
token.release()
| def watchWithModifiers | ( | self, | |
| name, | |||
| event, | |||
startState = False, |
|||
inputSource = None |
|||
| ) |
tuple notify = DirectNotifyGlobal.directNotify.newCategory("InputState") [static] |
1.7.3