|
Panda3D
|
Public Member Functions | |
| __init__ (self) | |
| debugPrint (self, message) | |
| delete (self) | |
| force (self, name, value, inputSource) | |
| getEventName (self, name) | |
| isSet (self, name, inputSource=None) | |
| releaseInputs (self, name) | |
| set (self, name, isActive, inputSource=None) | |
| watch (self, name, eventOn, eventOff, startState=False, inputSource=None) | |
| watchWithModifiers (self, name, event, startState=False, inputSource=None) | |
Public Member Functions inherited from DirectObject | |
| __init__ (self) | |
| accept (self, event, method, extraArgs=[]) | |
| acceptOnce (self, event, method, extraArgs=[]) | |
| addTask (self, *args, **kwargs) | |
| detectLeaks (self) | |
| doMethodLater (self, *args, **kwargs) | |
| getAllAccepting (self) | |
| ignore (self, event) | |
| ignoreAll (self) | |
| isAccepting (self, event) | |
| isIgnoring (self, event) | |
| removeAllTasks (self) | |
| removeTask (self, taskOrName) | |
Public Attributes | |
| set | |
Static Public Attributes | |
| str | ArrowKeys = 'ArrowKeys' |
| debug_print = debugPrint | |
| get_event_name = getEventName | |
| is_set = isSet | |
| str | Keyboard = 'Keyboard' |
| str | Mouse = 'Mouse' |
| notify = DirectNotifyGlobal.directNotify.newCategory("InputState") | |
| str | QE = 'QE' |
| release_inputs = releaseInputs | |
| str | WASD = 'WASD' |
| watch_with_modifiers = watchWithModifiers | |
Static Public Attributes inherited from DirectObject | |
| accept_once = acceptOnce | |
| add_task = addTask | |
| detect_leaks = detectLeaks | |
| do_method_later = doMethodLater | |
| get_all_accepting = getAllAccepting | |
| ignore_all = ignoreAll | |
| is_accepting = isAccepting | |
| is_ignoring = isIgnoring | |
| remove_all_tasks = removeAllTasks | |
| remove_task = removeTask | |
Protected Member Functions | |
| _ignore (self, token) | |
| _unforce (self, token) | |
Protected Member Functions inherited from DirectObject | |
| _addTask (self, task) | |
| _clearTask (self, task) | |
Protected Attributes | |
| dict | _forcingOff = {} |
| dict | _forcingOn = {} |
| dict | _state = {} |
| dict | _token2forceInfo = {} |
| dict | _token2inputSource = {} |
| dict | _watching = {} |
Protected Attributes inherited from DirectObject | |
| dict | _taskList = {} |
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.
| __init__ | ( | self | ) |
|
protected |
Undo a watch(). Don't call this directly, call release() on the token that watch() returned.
|
protected |
Stop forcing a value. Don't call this directly, call release() on your token.
| debugPrint | ( | self, | |
| message ) |
for debugging
| delete | ( | self | ) |
| 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()
| getEventName | ( | self, | |
| name ) |
| isSet | ( | self, | |
| name, | |||
| inputSource = None ) |
returns True/False
| releaseInputs | ( | self, | |
| name ) |
| set | ( | self, | |
| name, | |||
| isActive, | |||
| inputSource = None ) |
| 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.
Example::
# set up
token = inputState.watch('forward', 'w', 'w-up', inputSource=inputState.WASD)
...
# tear down
token.release()
| watchWithModifiers | ( | self, | |
| name, | |||
| event, | |||
| startState = False, | |||
| inputSource = None ) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
| set |
|
static |
|
static |