CEL: Crystal Entity Layer: physicallayer/pl.h Source File (CEL: Crystal Entity Layer Public API Reference)

| ## Public API Reference

- Main Page
- Classes
- Files

# 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
    00028 struct iObject;
    00029 struct iCelEntity;
    00030 struct iCelEntityList;
    00031 struct iCelDataBuffer;
    00032 struct iCelMessage;
    00033 struct iCelPropertyClass;
    00034 struct iCelPropertyClassFactory;
    00035 struct iCelBlLayer;
    00036 struct iCelBehaviour;
    00037 struct iCelEntityTemplate;
    00038 struct iSector;
    00039 struct iCamera;
    00040 class csVector3;
    00041 class csBox3;
    00042 class csString;
    00043
    00044 #define CEL_EVENT_PRE 0
    00045 #define CEL_EVENT_VIEW 1
    00046 #define CEL_EVENT_POST 2
    00047
    00049 typedef csHash<csStrKey, csStrKey> celEntityTemplateParams;
    00050
    00051 struct iCelEntityTracker;
    00052
    00057 struct iCelNewEntityCallback : public virtual iBase
    00058 {
    00059   SCF_INTERFACE (iCelNewEntityCallback, 0, 0, 2);
    00060
    00062   virtual void NewEntity (iCelEntity* entity) = 0;
    00063 };
    00064
    00069 struct iCelEntityRemoveCallback : public virtual iBase
    00070 {
    00071   SCF_INTERFACE (iCelEntityRemoveCallback, 0, 0, 2);
    00072
    00074   virtual void RemoveEntity (iCelEntity* entity) = 0;
    00075 };
    00076
    00077
    00082 struct iCelTimerListener : public virtual iBase
    00083 {
    00084   SCF_INTERFACE (iCelTimerListener, 0, 0, 1);
    00085
    00090   virtual void TickEveryFrame () = 0;
    00091
    00096   virtual void TickOnce () = 0;
    00097 };
    00098
    00099 SCF_VERSION (iCelPlLayer, 0, 3, 2);
    00100
    00104 struct iCelPlLayer : public iBase
    00105 {
    00111   virtual csPtr<iCelEntity> CreateEntity () = 0;
    00112
    00117   virtual csPtr<iCelEntity> CreateEntityInScope (int scope) = 0;
    00118
    00124   virtual csPtr<iCelEntity> CreateEntity (uint id) = 0;
    00125
    00141   virtual csPtr<iCelEntity> CreateEntity (const char* entname,
    00142         iCelBlLayer* bl, const char* bhname, ...) = 0;
    00143
    00147   virtual void RemoveEntity (iCelEntity* entity) = 0;
    00148
    00152   virtual void RemoveEntities () = 0;
    00153
    00158   virtual iCelEntityTemplate* CreateEntityTemplate (const char* factname) = 0;
    00159
    00163   virtual void RemoveEntityTemplate (iCelEntityTemplate* entfact) = 0;
    00164
    00168   virtual void RemoveEntityTemplates () = 0;
    00169
    00173   virtual iCelEntityTemplate* FindEntityTemplate (const char* factname) = 0;
    00174
    00182   virtual iCelEntity* CreateEntity (iCelEntityTemplate* factory,
    00183         const char* name, const celEntityTemplateParams& params) = 0;
    00184
    00188   virtual csPtr<iCelMessage> CreateMessage (const char* msg_string, ...) = 0;
    00189
    00196   virtual csPtr<iCelDataBuffer> CreateDataBuffer (long serialnr) = 0;
    00197
    00203   virtual void AttachEntity (iObject* object, iCelEntity* entity) = 0;
    00204
    00208   virtual void UnattachEntity (iObject* object, iCelEntity* entity) = 0;
    00209
    00213   virtual iCelEntity* GetEntity (uint id) = 0;
    00214
    00218   virtual size_t GetEntityCount () const = 0;
    00219
    00223   virtual iCelEntity* GetEntityByIndex (size_t idx) const = 0;
    00224
    00230   virtual iCelEntity* FindEntity (const char* name) = 0;
    00231
    00236   virtual iCelBehaviour* GetBehaviour (uint id) = 0;
    00237
    00241   virtual iCelEntity* FindAttachedEntity (iObject* object) = 0;
    00242
    00247   virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector,
    00248         const csVector3& pos, float radius) = 0;
    00249
    00254   virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector,
    00255         const csBox3& box) = 0;
    00256
    00262   virtual iCelEntity* GetHitEntity (iCamera* camera, int x, int y) = 0;
    00263
    00267   virtual csPtr<iCelEntityList> CreateEmptyEntityList () = 0;
    00268
    00273   virtual iCelEntityTracker* CreateEntityTracker (const char* name) = 0;
    00274
    00278   virtual iCelEntityTracker* FindEntityTracker (const char* name) = 0;
    00279
    00283   virtual void RemoveEntityTracker (iCelEntityTracker* tracker) = 0;
    00284
    00292   virtual void SetEntityAddonAllowed (bool allow) = 0;
    00293
    00297   virtual bool IsEntityAddonAllowed () const = 0;
    00298
    00299   //-------------------------------------------------------------------------
    00300
    00306   virtual bool LoadPropertyClassFactory (const char* plugin_id) = 0;
    00307
    00314   virtual void RegisterPropertyClassFactory (iCelPropertyClassFactory* pf) = 0;
    00315
    00319   virtual void UnregisterPropertyClassFactory (
    00320         iCelPropertyClassFactory* pf) = 0;
    00321
    00325   virtual size_t GetPropertyClassFactoryCount () const = 0;
    00326
    00330   virtual iCelPropertyClassFactory* GetPropertyClassFactory (size_t idx)
    00331         const = 0;
    00332
    00336   virtual iCelPropertyClassFactory* FindPropertyClassFactory (
    00337         const char* name) const = 0;
    00338
    00344   virtual iCelPropertyClass* CreatePropertyClass
    00345       (iCelEntity* entity, const char* propname) = 0;
    00346
    00352   virtual iCelPropertyClass* CreateTaggedPropertyClass
    00353       (iCelEntity* entity, const char* propname, const char* tagname) = 0;
    00354
    00355   //-------------------------------------------------------------------------
    00356
    00360   virtual void RegisterBehaviourLayer (iCelBlLayer* bl) = 0;
    00361
    00365   virtual void UnregisterBehaviourLayer (iCelBlLayer* bl) = 0;
    00366
    00370   virtual size_t GetBehaviourLayerCount () const = 0;
    00371
    00375   virtual iCelBlLayer* GetBehaviourLayer (size_t idx) const = 0;
    00376
    00380   virtual iCelBlLayer* FindBehaviourLayer (const char* name) const = 0;
    00381
    00382   //-------------------------------------------------------------------------
    00383
    00389   virtual void Cache (iBase* object) = 0;
    00390
    00394   virtual void Uncache (iBase* object) = 0;
    00395
    00401   virtual void CleanCache () = 0;
    00402
    00403   //-------------------------------------------------------------------------
    00404
    00415   virtual csStringID FetchStringID (const char* str) = 0;
    00416
    00421   virtual const char* FetchString (csStringID id) = 0;
    00422
    00427   virtual void AddEntityRemoveCallback (iCelEntityRemoveCallback* clback) = 0;
    00428
    00432   virtual void RemoveEntityRemoveCallback (
    00433         iCelEntityRemoveCallback* clback) = 0;
    00434
    00439   virtual void AddNewEntityCallback (iCelNewEntityCallback* clback) = 0;
    00440
    00444   virtual void RemoveNewEntityCallback (iCelNewEntityCallback* clback) = 0;
    00445
    00446   //-------------------------------------------------------------------------
    00447
    00455   virtual void CallbackEveryFrame (iCelTimerListener* listener, int where) = 0;
    00456
    00465   virtual void CallbackOnce (iCelTimerListener* listener, csTicks delta,
    00466         int where) = 0;
    00467
    00471   virtual void RemoveCallbackEveryFrame (iCelTimerListener* listener,
    00472         int where) = 0;
    00473
    00477   virtual void RemoveCallbackOnce (iCelTimerListener* listener, int where) = 0;
    00478
    00485   virtual int AddScope (csString version, int size) = 0;
    00486 };
    00487
    00488 SCF_VERSION (iCelEntityTracker, 0, 0, 1);
    00489
    00495 struct iCelEntityTracker : public iBase
    00496 {
    00500   virtual const char* GetName () const = 0;
    00501
    00507   virtual bool AddEntity (iCelEntity* entity) = 0;
    00508
    00512   virtual void RemoveEntity (iCelEntity* entity) = 0;
    00513
    00517   virtual void RemoveEntities () = 0;
    00518
    00523   virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector,
    00524         const csVector3& pos, float radius) = 0;
    00525 };
    00526
    00527 #endif // __CEL_PL_PL__
    00528