Panda3D
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties
Public Member Functions | Static Public Attributes | List of all members
InputState Class Reference
Inheritance diagram for InputState:

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'
 

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

def __init__ (   self)

Member Function Documentation

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 
)

Member Data Documentation

string ArrowKeys = 'ArrowKeys'
static
string Keyboard = 'Keyboard'
static
string Mouse = 'Mouse'
static
tuple notify = DirectNotifyGlobal.directNotify.newCategory("InputState")
static
string QE = 'QE'
static
string WASD = 'WASD'
static