Panda3D
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
InputState Class Reference
Inheritance diagram for InputState:

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 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
 

Protected Member Functions

 _ignore (self, token)
 
 _unforce (self, token)
 

Protected Attributes

 _forcingOff
 
 _forcingOn
 
 _state
 
 _token2forceInfo
 
 _token2inputSource
 
 _watching
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self)

Member Function Documentation

◆ _ignore()

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

◆ _unforce()

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

◆ debugPrint()

debugPrint ( self,
message )
for debugging

◆ delete()

delete ( self)

◆ force()

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

getEventName ( self,
name )

◆ isSet()

isSet ( self,
name,
inputSource = None )
returns True/False

◆ releaseInputs()

releaseInputs ( self,
name )

◆ set()

set ( self,
name,
isActive,
inputSource = None )

◆ watch()

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

watchWithModifiers ( self,
name,
event,
startState = False,
inputSource = None )

Member Data Documentation

◆ _forcingOff

_forcingOff
protected

◆ _forcingOn

_forcingOn
protected

◆ _state

_state
protected

◆ _token2forceInfo

_token2forceInfo
protected

◆ _token2inputSource

_token2inputSource
protected

◆ _watching

_watching
protected

◆ ArrowKeys

str ArrowKeys = 'ArrowKeys'
static

◆ debug_print

debug_print = debugPrint
static

◆ get_event_name

get_event_name = getEventName
static

◆ is_set

is_set = isSet
static

◆ Keyboard

str Keyboard = 'Keyboard'
static

◆ Mouse

str Mouse = 'Mouse'
static

◆ notify

notify = DirectNotifyGlobal.directNotify.newCategory("InputState")
static

◆ QE

str QE = 'QE'
static

◆ release_inputs

release_inputs = releaseInputs
static

◆ set

set

◆ WASD

str WASD = 'WASD'
static

◆ watch_with_modifiers

watch_with_modifiers = watchWithModifiers
static