Panda3D
Public Member Functions | Static Public Attributes | List of all members
InputState Class Reference
Inheritance diagram for InputState:

Public Member Functions

def __init__ (self)
 
def debugPrint (self, message)
 
def delete (self)
 
def force (self, name, value, inputSource)
 
def getEventName (self, name)
 
def isSet (self, name, inputSource=None)
 
def releaseInputs (self, name)
 
def set (self, name, isActive, inputSource=None)
 
def watch (self, name, eventOn, eventOff, startState=False, inputSource=None)
 
def watchWithModifiers (self, name, event, startState=False, inputSource=None)
 

Static Public Attributes

string ArrowKeys = 'ArrowKeys'
 
def debug_print = debugPrint
 
def get_event_name = getEventName
 
def is_set = isSet
 
string Keyboard = 'Keyboard'
 
string Mouse = 'Mouse'
 
 notify = DirectNotifyGlobal.directNotify.newCategory("InputState")
 
string QE = 'QE'
 
def release_inputs = releaseInputs
 
string WASD = 'WASD'
 
def watch_with_modifiers = watchWithModifiers
 

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

def __init__ (   self)

Member Function Documentation

◆ debugPrint()

def debugPrint (   self,
  message 
)
for debugging

◆ delete()

def delete (   self)

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

◆ getEventName()

def getEventName (   self,
  name 
)

◆ isSet()

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

◆ releaseInputs()

def releaseInputs (   self,
  name 
)

◆ set()

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

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

Member Data Documentation

◆ ArrowKeys

string ArrowKeys = 'ArrowKeys'
static

◆ debug_print

def debug_print = debugPrint
static

◆ get_event_name

def get_event_name = getEventName
static

◆ is_set

def is_set = isSet
static

◆ Keyboard

string Keyboard = 'Keyboard'
static

◆ Mouse

string Mouse = 'Mouse'
static

◆ notify

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

◆ QE

string QE = 'QE'
static

◆ release_inputs

def release_inputs = releaseInputs
static

◆ WASD

string WASD = 'WASD'
static

◆ watch_with_modifiers

def watch_with_modifiers = watchWithModifiers
static