# InputState

from direct.controls.InputState import InputState

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.

## Inheritance:

InputState:

## Methods of InputState:

__init__
_ignore
_unforce
debugPrint
delete
force
isSet
releaseInputs
set
watch
watchWithModifiers

__init__ def __init__(self) Undocumented function.

_ignore def _ignore(self, token) Undo a watch(). Don't call this directly, call release() on the token that watch() returned.

_unforce def _unforce(self, token) Stop forcing a value. Don't call this directly, call release() on your token.

debugPrint def debugPrint(self, message) for debugging

delete def delete(self) Undocumented function.

force 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()

isSet def isSet(self, name) returns True/False

releaseInputs def releaseInputs(self, name) Undocumented function.

set def set(self, name, isActive, inputSource=None) Undocumented function.

watch 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()

watchWithModifiers def watchWithModifiers(self, name, event, startState=False, inputSource=None) Undocumented function.