CEL

Public API Reference

physicallayer/pl.h

00001 /*
00002     Crystal Space Entity Layer
00003     Copyright (C) 2001-2005 by Jorrit Tyberghein
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public
00016     License along with this library; if not, write to the Free
00017     Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018 */
00019 
00020 #ifndef __CEL_PL_PL__
00021 #define __CEL_PL_PL__
00022 
00023 #include "cstypes.h"
00024 #include "csutil/scf.h"
00025 #include "csutil/strset.h"
00026 #include "csutil/ref.h"
00027 #include "csutil/csstring.h"
00028 
00029 struct iObject;
00030 struct iCelEntity;
00031 struct iCelEntityList;
00032 struct iCelEntityIterator;
00033 struct iCelDataBuffer;
00034 struct iCelMessage;
00035 struct iCelPropertyClass;
00036 struct iCelPropertyClassFactory;
00037 struct iCelBlLayer;
00038 struct iCelBehaviour;
00039 struct iCelEntityTemplate;
00040 struct iSector;
00041 struct iCamera;
00042 class csVector3;
00043 class csBox3;
00044 class csString;
00045 
00046 #define CEL_EVENT_PRE 0
00047 #define CEL_EVENT_VIEW 1
00048 #define CEL_EVENT_POST 2
00049 
00050 #define CEL_PROPCLASS_END (void*)0
00051 #define CEL_PARAM_END (void*)0
00052 
00054 typedef csHash<csStringFast<12>, csStringFast<12> > celEntityTemplateParams;
00055 
00056 struct iCelEntityTracker;
00057 
00062 struct iCelNewEntityCallback : public virtual iBase
00063 {
00064   SCF_INTERFACE (iCelNewEntityCallback, 0, 0, 2);
00065 
00067   virtual void NewEntity (iCelEntity* entity) = 0;
00068 };
00069 
00074 struct iCelEntityRemoveCallback : public virtual iBase
00075 {
00076   SCF_INTERFACE (iCelEntityRemoveCallback, 0, 0, 2);
00077 
00079   virtual void RemoveEntity (iCelEntity* entity) = 0;
00080 };
00081 
00082 
00087 struct iCelTimerListener : public virtual iBase
00088 {
00089   SCF_INTERFACE (iCelTimerListener, 0, 0, 1);
00090 
00095   virtual void TickEveryFrame () = 0;
00096 
00101   virtual void TickOnce () = 0;
00102 };
00103 
00104 SCF_VERSION (iCelPlLayer, 0, 3, 2);
00105 
00109 struct iCelPlLayer : public iBase
00110 {
00116   virtual csPtr<iCelEntity> CreateEntity () = 0;
00117 
00122   virtual csPtr<iCelEntity> CreateEntityInScope (int scope) = 0;
00123 
00129   virtual csPtr<iCelEntity> CreateEntity (uint id) = 0;
00130 
00146   virtual csPtr<iCelEntity> CreateEntity (const char* entname,
00147         iCelBlLayer* bl, const char* bhname, ...) = 0;
00148 
00154   virtual void RemoveEntity (iCelEntity* entity) = 0;
00155 
00159   virtual void RemoveEntities () = 0;
00160 
00165   virtual iCelEntityTemplate* CreateEntityTemplate (const char* factname) = 0;
00166 
00170   virtual void RemoveEntityTemplate (iCelEntityTemplate* entfact) = 0;
00171 
00175   virtual void RemoveEntityTemplates () = 0;
00176 
00180   virtual iCelEntityTemplate* FindEntityTemplate (const char* factname) = 0;
00181 
00185   virtual size_t GetEntityTemplateCount () const = 0;
00186 
00190   virtual iCelEntityTemplate* GetEntityTemplate (size_t idx) const = 0;
00191 
00199   virtual iCelEntity* CreateEntity (iCelEntityTemplate* factory,
00200         const char* name, const celEntityTemplateParams& params) = 0;
00201 
00211   virtual iCelEntity* CreateEntity (iCelEntityTemplate* factory,
00212         const char* name, ...) = 0;
00213 
00220   virtual csPtr<iCelDataBuffer> CreateDataBuffer (long serialnr) = 0;
00221 
00227   virtual void AttachEntity (iObject* object, iCelEntity* entity) = 0;
00228 
00232   virtual void UnattachEntity (iObject* object, iCelEntity* entity) = 0;
00233 
00237   virtual iCelEntity* GetEntity (uint id) = 0;
00238 
00242   virtual size_t GetEntityCount () const = 0;
00243 
00247   virtual iCelEntity* GetEntityByIndex (size_t idx) const = 0;
00248 
00254   virtual iCelEntity* FindEntity (const char* name) = 0;
00255 
00260   virtual iCelBehaviour* GetBehaviour (uint id) = 0;
00261 
00265   virtual iCelEntity* FindAttachedEntity (iObject* object) = 0;
00266 
00272   virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector,
00273         const csVector3& pos, float radius, bool do_invisible = false) = 0;
00274 
00280   virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector,
00281         const csBox3& box, bool do_invisible = false) = 0;
00282 
00288   virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector,
00289         const csVector3& start, const csVector3& end,
00290         bool do_invisible = false) = 0;
00291 
00297   virtual iCelEntity* GetHitEntity (iCamera* camera, int x, int y) = 0;
00298 
00302   virtual csPtr<iCelEntityList> CreateEmptyEntityList () = 0;
00303 
00308   virtual iCelEntityTracker* CreateEntityTracker (const char* name) = 0;
00309 
00313   virtual iCelEntityTracker* FindEntityTracker (const char* name) = 0;
00314 
00318   virtual void RemoveEntityTracker (iCelEntityTracker* tracker) = 0;
00319 
00327   virtual void SetEntityAddonAllowed (bool allow) = 0;
00328 
00332   virtual bool IsEntityAddonAllowed () const = 0;
00333 
00334   //-------------------------------------------------------------------------
00335 
00341   virtual bool LoadPropertyClassFactory (const char* plugin_id) = 0;
00342 
00349   virtual void RegisterPropertyClassFactory (iCelPropertyClassFactory* pf) = 0;
00350 
00354   virtual void UnregisterPropertyClassFactory (
00355         iCelPropertyClassFactory* pf) = 0;
00356 
00360   virtual size_t GetPropertyClassFactoryCount () const = 0;
00361 
00365   virtual iCelPropertyClassFactory* GetPropertyClassFactory (size_t idx)
00366         const = 0;
00367 
00371   virtual iCelPropertyClassFactory* FindPropertyClassFactory (
00372         const char* name) const = 0;
00373 
00379   virtual iCelPropertyClass* CreatePropertyClass
00380       (iCelEntity* entity, const char* propname) = 0;
00381 
00387   virtual iCelPropertyClass* CreateTaggedPropertyClass
00388       (iCelEntity* entity, const char* propname, const char* tagname) = 0;
00389 
00390   //-------------------------------------------------------------------------
00391 
00395   virtual void RegisterBehaviourLayer (iCelBlLayer* bl) = 0;
00396 
00400   virtual void UnregisterBehaviourLayer (iCelBlLayer* bl) = 0;
00401 
00405   virtual size_t GetBehaviourLayerCount () const = 0;
00406 
00410   virtual iCelBlLayer* GetBehaviourLayer (size_t idx) const = 0;
00411 
00415   virtual iCelBlLayer* FindBehaviourLayer (const char* name) const = 0;
00416 
00417   //-------------------------------------------------------------------------
00418 
00424   virtual void Cache (iBase* object) = 0;
00425 
00429   virtual void Uncache (iBase* object) = 0;
00430 
00436   virtual void CleanCache () = 0;
00437 
00438   //-------------------------------------------------------------------------
00439 
00450   virtual csStringID FetchStringID (const char* str) = 0;
00451 
00456   virtual const char* FetchString (csStringID id) = 0;
00457 
00462   virtual void AddEntityRemoveCallback (iCelEntityRemoveCallback* clback) = 0;
00463 
00467   virtual void RemoveEntityRemoveCallback (
00468         iCelEntityRemoveCallback* clback) = 0;
00469 
00474   virtual void AddNewEntityCallback (iCelNewEntityCallback* clback) = 0;
00475 
00479   virtual void RemoveNewEntityCallback (iCelNewEntityCallback* clback) = 0;
00480 
00481   //-------------------------------------------------------------------------
00482 
00496   virtual void CallbackEveryFrame (iCelTimerListener* listener, int where) = 0;
00497 
00512   virtual void CallbackOnce (iCelTimerListener* listener, csTicks delta,
00513         int where) = 0;
00514 
00518   virtual void RemoveCallbackEveryFrame (iCelTimerListener* listener,
00519         int where) = 0;
00520 
00524   virtual void RemoveCallbackOnce (iCelTimerListener* listener, int where) = 0;
00525 
00532   virtual int AddScope (csString version, int size) = 0;
00533 };
00534 
00535 SCF_VERSION (iCelEntityTracker, 0, 0, 2);
00536 
00542 struct iCelEntityTracker : public iBase
00543 {
00547   virtual const char* GetName () const = 0;
00548 
00554   virtual bool AddEntity (iCelEntity* entity) = 0;
00555 
00559   virtual void RemoveEntity (iCelEntity* entity) = 0;
00560 
00564   virtual void RemoveEntities () = 0;
00565 
00570   virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector,
00571         const csVector3& pos, float radius) = 0;
00572 
00576   virtual csPtr<iCelEntityIterator> GetIterator () = 0;
00577 
00581   virtual void AddEntities (iCelEntityTracker* tracker) = 0;
00582 
00586   virtual void RemoveEntities (iCelEntityTracker* tracker) = 0;
00587 };
00588 
00589 #endif // __CEL_PL_PL__
00590 

Generated for CEL: Crystal Entity Layer by doxygen 1.4.7