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 
00028 struct iObject;
00029 struct iCelEntity;
00030 struct iCelEntityList;
00031 struct iCelEntityIterator;
00032 struct iCelDataBuffer;
00033 struct iCelMessage;
00034 struct iCelPropertyClass;
00035 struct iCelPropertyClassFactory;
00036 struct iCelBlLayer;
00037 struct iCelBehaviour;
00038 struct iCelEntityTemplate;
00039 struct iSector;
00040 struct iCamera;
00041 class csVector3;
00042 class csBox3;
00043 class csString;
00044 
00045 #define CEL_EVENT_PRE 0
00046 #define CEL_EVENT_VIEW 1
00047 #define CEL_EVENT_POST 2
00048 
00049 #define CEL_PROPCLASS_END (void*)0
00050 #define CEL_PARAM_END (void*)0
00051 
00053 typedef csHash<csStrKey, csStrKey> celEntityTemplateParams;
00054 
00055 struct iCelEntityTracker;
00056 
00061 struct iCelNewEntityCallback : public virtual iBase
00062 {
00063   SCF_INTERFACE (iCelNewEntityCallback, 0, 0, 2);
00064 
00066   virtual void NewEntity (iCelEntity* entity) = 0;
00067 };
00068 
00073 struct iCelEntityRemoveCallback : public virtual iBase
00074 {
00075   SCF_INTERFACE (iCelEntityRemoveCallback, 0, 0, 2);
00076 
00078   virtual void RemoveEntity (iCelEntity* entity) = 0;
00079 };
00080 
00081 
00086 struct iCelTimerListener : public virtual iBase
00087 {
00088   SCF_INTERFACE (iCelTimerListener, 0, 0, 1);
00089 
00094   virtual void TickEveryFrame () = 0;
00095 
00100   virtual void TickOnce () = 0;
00101 };
00102 
00103 SCF_VERSION (iCelPlLayer, 0, 3, 2);
00104 
00108 struct iCelPlLayer : public iBase
00109 {
00115   virtual csPtr<iCelEntity> CreateEntity () = 0;
00116 
00121   virtual csPtr<iCelEntity> CreateEntityInScope (int scope) = 0;
00122 
00128   virtual csPtr<iCelEntity> CreateEntity (uint id) = 0;
00129 
00145   virtual csPtr<iCelEntity> CreateEntity (const char* entname,
00146         iCelBlLayer* bl, const char* bhname, ...) = 0;
00147 
00153   virtual void RemoveEntity (iCelEntity* entity) = 0;
00154 
00158   virtual void RemoveEntities () = 0;
00159 
00164   virtual iCelEntityTemplate* CreateEntityTemplate (const char* factname) = 0;
00165 
00169   virtual void RemoveEntityTemplate (iCelEntityTemplate* entfact) = 0;
00170 
00174   virtual void RemoveEntityTemplates () = 0;
00175 
00179   virtual iCelEntityTemplate* FindEntityTemplate (const char* factname) = 0;
00180 
00184   virtual size_t GetEntityTemplateCount () const = 0;
00185 
00189   virtual iCelEntityTemplate* GetEntityTemplate (size_t idx) const = 0;
00190 
00198   virtual iCelEntity* CreateEntity (iCelEntityTemplate* factory,
00199         const char* name, const celEntityTemplateParams& params) = 0;
00200 
00210   virtual iCelEntity* CreateEntity (iCelEntityTemplate* factory,
00211         const char* name, ...) = 0;
00212 
00219   virtual csPtr<iCelDataBuffer> CreateDataBuffer (long serialnr) = 0;
00220 
00226   virtual void AttachEntity (iObject* object, iCelEntity* entity) = 0;
00227 
00231   virtual void UnattachEntity (iObject* object, iCelEntity* entity) = 0;
00232 
00236   virtual iCelEntity* GetEntity (uint id) = 0;
00237 
00241   virtual size_t GetEntityCount () const = 0;
00242 
00246   virtual iCelEntity* GetEntityByIndex (size_t idx) const = 0;
00247 
00253   virtual iCelEntity* FindEntity (const char* name) = 0;
00254 
00259   virtual iCelBehaviour* GetBehaviour (uint id) = 0;
00260 
00264   virtual iCelEntity* FindAttachedEntity (iObject* object) = 0;
00265 
00271   virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector,
00272         const csVector3& pos, float radius, bool do_invisible = false) = 0;
00273 
00279   virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector,
00280         const csBox3& box, bool do_invisible = false) = 0;
00281 
00287   virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector,
00288         const csVector3& start, const csVector3& end,
00289         bool do_invisible = false) = 0;
00290 
00296   virtual iCelEntity* GetHitEntity (iCamera* camera, int x, int y) = 0;
00297 
00301   virtual csPtr<iCelEntityList> CreateEmptyEntityList () = 0;
00302 
00307   virtual iCelEntityTracker* CreateEntityTracker (const char* name) = 0;
00308 
00312   virtual iCelEntityTracker* FindEntityTracker (const char* name) = 0;
00313 
00317   virtual void RemoveEntityTracker (iCelEntityTracker* tracker) = 0;
00318 
00326   virtual void SetEntityAddonAllowed (bool allow) = 0;
00327 
00331   virtual bool IsEntityAddonAllowed () const = 0;
00332 
00333   //-------------------------------------------------------------------------
00334 
00340   virtual bool LoadPropertyClassFactory (const char* plugin_id) = 0;
00341 
00348   virtual void RegisterPropertyClassFactory (iCelPropertyClassFactory* pf) = 0;
00349 
00353   virtual void UnregisterPropertyClassFactory (
00354         iCelPropertyClassFactory* pf) = 0;
00355 
00359   virtual size_t GetPropertyClassFactoryCount () const = 0;
00360 
00364   virtual iCelPropertyClassFactory* GetPropertyClassFactory (size_t idx)
00365         const = 0;
00366 
00370   virtual iCelPropertyClassFactory* FindPropertyClassFactory (
00371         const char* name) const = 0;
00372 
00378   virtual iCelPropertyClass* CreatePropertyClass
00379       (iCelEntity* entity, const char* propname) = 0;
00380 
00386   virtual iCelPropertyClass* CreateTaggedPropertyClass
00387       (iCelEntity* entity, const char* propname, const char* tagname) = 0;
00388 
00389   //-------------------------------------------------------------------------
00390 
00394   virtual void RegisterBehaviourLayer (iCelBlLayer* bl) = 0;
00395 
00399   virtual void UnregisterBehaviourLayer (iCelBlLayer* bl) = 0;
00400 
00404   virtual size_t GetBehaviourLayerCount () const = 0;
00405 
00409   virtual iCelBlLayer* GetBehaviourLayer (size_t idx) const = 0;
00410 
00414   virtual iCelBlLayer* FindBehaviourLayer (const char* name) const = 0;
00415 
00416   //-------------------------------------------------------------------------
00417 
00423   virtual void Cache (iBase* object) = 0;
00424 
00428   virtual void Uncache (iBase* object) = 0;
00429 
00435   virtual void CleanCache () = 0;
00436 
00437   //-------------------------------------------------------------------------
00438 
00449   virtual csStringID FetchStringID (const char* str) = 0;
00450 
00455   virtual const char* FetchString (csStringID id) = 0;
00456 
00461   virtual void AddEntityRemoveCallback (iCelEntityRemoveCallback* clback) = 0;
00462 
00466   virtual void RemoveEntityRemoveCallback (
00467         iCelEntityRemoveCallback* clback) = 0;
00468 
00473   virtual void AddNewEntityCallback (iCelNewEntityCallback* clback) = 0;
00474 
00478   virtual void RemoveNewEntityCallback (iCelNewEntityCallback* clback) = 0;
00479 
00480   //-------------------------------------------------------------------------
00481 
00495   virtual void CallbackEveryFrame (iCelTimerListener* listener, int where) = 0;
00496 
00511   virtual void CallbackOnce (iCelTimerListener* listener, csTicks delta,
00512         int where) = 0;
00513 
00517   virtual void RemoveCallbackEveryFrame (iCelTimerListener* listener,
00518         int where) = 0;
00519 
00523   virtual void RemoveCallbackOnce (iCelTimerListener* listener, int where) = 0;
00524 
00531   virtual int AddScope (csString version, int size) = 0;
00532 };
00533 
00534 SCF_VERSION (iCelEntityTracker, 0, 0, 2);
00535 
00541 struct iCelEntityTracker : public iBase
00542 {
00546   virtual const char* GetName () const = 0;
00547 
00553   virtual bool AddEntity (iCelEntity* entity) = 0;
00554 
00558   virtual void RemoveEntity (iCelEntity* entity) = 0;
00559 
00563   virtual void RemoveEntities () = 0;
00564 
00569   virtual csPtr<iCelEntityList> FindNearbyEntities (iSector* sector,
00570         const csVector3& pos, float radius) = 0;
00571 
00575   virtual csPtr<iCelEntityIterator> GetIterator () = 0;
00576 
00580   virtual void AddEntities (iCelEntityTracker* tracker) = 0;
00581 
00585   virtual void RemoveEntities (iCelEntityTracker* tracker) = 0;
00586 };
00587 
00588 #endif // __CEL_PL_PL__
00589 

Generated for CEL: Crystal Entity Layer by doxygen 1.4.7