| Line 140: | Line 140: | ||
|- | |- | ||
|iPcInventoryListener||[http://www.crystalspace3d.org/cel/docs/online/api/structiPcInventoryListener.html api] | |iPcInventoryListener||[http://www.crystalspace3d.org/cel/docs/online/api/structiPcInventoryListener.html api] | ||
| + | |- | ||
| + | |iCelInventorySpace||[http://www.crystalspace3d.org/cel/docs/online/api/structiCelInventorySpace.html api] | ||
| + | |- | ||
| + | |iCelInventorySpaceSlot||[http://www.crystalspace3d.org/cel/docs/online/api/structiCelInventorySpaceSlot.html api] | ||
|- | |- | ||
|iPcTriggerListener||[http://www.crystalspace3d.org/cel/docs/online/api/structiPcTriggerListener.html api] | |iPcTriggerListener||[http://www.crystalspace3d.org/cel/docs/online/api/structiPcTriggerListener.html api] | ||
Current revision
Contents |
Introduction
There are a number of interfaces in cs and cel which can serve as callbacks to discover things happening in engine. To be able to use this functionality, one must inherit from special python base classes.
There are two modules in csexternal repository that provide such classes, one for cs and one for cel: cscallback and celcallback.
In general for a given interface, there is a base class, with the naming convention of prefixing with py instead of i as is normal for interfaces.
In the cscallback module there are also a couple classes (see tables below) that can be inherited from, these don't need any name change.
Example
For example, in iMovableListener this would be pyMovableListener. To use it just declare your class inheriting from this, and implement the needed interface functions in your class.
from cscallback import pyMovableListener
class MyMovableListener(pyMovableListener):
# constructor
def __init__(self):
pyMovableListener.__init__(self,ObjectRegistry)
# callback functions
def MovableChanged(self,movable):
print "movable changed"
def MovableDestroyed(self,movable):
print "movable destroyed"
movlistener = MyMovableListener()
Movable.AddListener(movlistener)
Note how the constructor for all callback classes requires that you pass the object registry (in the previous example, it is assumed ObjectRegistry is the object registry, and Movable a valid movable).
Supported interfaces
cscallback
interfaces
| iMissingLoaderData | api |
| iTerrainCellHeightDataCallback | api |
| iTerrainCellLoadCallback | api |
| iParticleEmitter | api |
| iParticleEffector | api |
| iSkeletonBoneUpdateCallback | api |
| iSkeletonAnimationCallback | api |
| iSkeletonUpdateCallback | api |
| iMeshObjectDrawCallback | api |
| iObjectModelListener | api |
| iObjectNameChangeListener | api |
| iProcTexCallback | api |
| iODEFrameUpdateCallback | api |
| iReporterListener | api |
| iStandardReporterListener | api |
| iDynamicsStepCallback | api |
| iDynamicsMoveCallback | api |
| iDynamicsCollisionCallback | api |
| iDynamicsColliderCollisionCallback | api |
| iOffscreenCanvasCallback | api |
| iVisibilityCullerListener | api |
| iLightCallback | api |
| iPortalCallback | api |
| iCameraSectorListener | api |
| iEngineFrameCallback | api |
| iEngineSectorCallback | api |
| iSectorCallback | api |
| iSectorMeshCallback | api |
| iLightVisibleCallback | api |
| iMeshDrawCallback | api |
| iTextureCallback | api |
| iMovableListener | api |
| iSndSysStreamCallback | api |
| iSndSysRendererCallback | api |
| iSndSysListener | api |
| iSndSysListenerDoppler | api |
classes
classes that can be directly inherited.
| csBaseEventHandler | api |
| csApplicationFramework | api |
celcallback
interfaces
| iQuestTriggerCallback | api |
| iQuestSequenceCallback | api |
| iCelNewEntityCallback | api |
| iCelEntityRemoveCallback | api |
| iCelTimerListener | api |
| iPcInventoryListener | api |
| iCelInventorySpace | api |
| iCelInventorySpaceSlot | api |
| iPcTriggerListener | api |
| iPcSoundListener | api |
| iPcPropertyListener | api |
| iPcMeshSelectListener | api |
| iPcGravityCallback | api |
Back to PyCrystal
