Exemple #1
0
 /// <summary>
 /// Constructs an entity buffer
 /// </summary>
 /// <param name="entityHash">the hash value for the entity hash table, larger means faster name searches but more memory</param>
 /// <param name="systemLinkHash">the hash value for system link hash table, larger means faster search but more memory</param>
 /// <param name="entityPagePower">the size of the entity pages in the form of a power of 2</param>
 /// <param name="entityPageCount">the initial number of entity pages, this has a small affect on early performance</param>
 /// <param name="entityComponentPagePower">the size of the entity component pages in the form of a power of 2</param>
 /// <param name="entityComponentPageCount">the initial number of entity pages, this has a small affect on early performance</param>
 /// <param name="entityListPagePower">the size of the entity list pages in the form of a power of 2</param>
 /// <param name="entityListPageCount">the initial number of entity pages, this has a small affect on early performance</param>
 /// <param name="systemLinkPagePower">the size of the systemlink pages in the form of a power of 2</param>
 /// <param name="systemLinkPageCount">the initial number of entity pages, this has a small affect on early performance</param>
 /// <param name="componentTypes">The registry for component types which is used to get type IDs if a system is registered before its type ids are filled out</param>
 public EntityBuffer(IComponentTypeRegistry componentTypes, int entityHash = 47, int systemLinkHash = 47, int entityPagePower = 8,
                     int entityComponentPagePower = 8, int entityListPagePower = 8, int systemLinkPagePower = 8, int entityPageCount = 1,
                     int entityComponentPageCount = 1, int entityListPageCount = 1, int systemLinkPageCount = 1)
 {
     _entities       = new NamedDataRegistry <BufferedBinarySearchTree <EntityLink> >(entityPagePower, entityPageCount, entityHash);
     _links          = new PagedArray <SystemLink>(systemLinkPagePower, systemLinkPageCount);
     _lists          = new PagedArray <EntityList>(systemLinkPagePower, systemLinkPageCount);
     _hashVal        = systemLinkHash;
     _starts         = new int[_hashVal];
     _ends           = new int[_hashVal];
     _listPower      = entityListPagePower;
     _listPages      = entityListPageCount;
     _entityPower    = entityComponentPagePower;
     _entityPages    = entityComponentPageCount;
     _componentTypes = componentTypes;
 }
Exemple #2
0
 /// <summary>
 /// Constructs an engine loader with the given parameters using the default admin
 /// </summary>
 /// <param name="targetLogicFrameLength">the frame length in seconds of logic updates which the engine will attempt to keep</param>
 /// <param name="targetMaxRenderFrameLength">the frame length in seconds of render updates which the engine will try to stay below</param>
 /// <param name="componentTypeRegistry">the component type registry to use to store component types</param>
 /// <param name="systemRegistry">the system registry to store systems</param>
 /// <param name="entityBuffer">the entity buffer to use to store entities</param>
 protected EngineLoader(IComponentTypeRegistry componentTypeRegistry,
                        ISystemRegistry systemRegistry, IEntityBuffer entityBuffer, float targetLogicFrameLength = 1f / 60f, float targetMaxRenderFrameLength = 1f / 30f)
 {
     Admin = new EntityAdmin(targetLogicFrameLength, targetMaxRenderFrameLength, componentTypeRegistry, systemRegistry, entityBuffer);
 }