public static void Init(EventManagerConfiguration config) { Debug.Assert(config.MaxEvents > 0u); Logger.Trace <EventManager>($"Initialize {nameof(EventManager)} with max events {config.MaxEvents}"); _maxEvents = (int)config.MaxEvents; _events = MemoryUtils.AllocateBlock <Event>(config.MaxEvents * 2); }
public SpriteRenderQueue(UIRenderQueueConfiguration config, TextManager textManager, FontManager fontManager) { var maxVertices = config.MaxSprites * 4 + config.MaxNinePatchSprites * 4 * 9 + config.MaxTextBlocks * 4 * 100; // 100 characters per block (TODO: change this at some point) var maxIndices = maxVertices * 6; _spriteBatch = new SpriteBatch(config.MaxSprites); _nineSliceSprite = new NineSliceSpriteBatch(config.MaxNinePatchSprites); _textBatch = new TextBatch(config.MaxTextBlocks, textManager, fontManager); _vertices = MemoryUtils.AllocateBlock <SpriteVertex>(maxVertices); _elements = new SpriteElement[100]; // TODO: Hardcoded for now, not sure what an optimal number would be. UIElements will be created for each texture change _sortable = new SortableRenderable[1_000]; // TODO: hardcoded for now. This is the amount of "items" added to the queue. 1 for each text, sprite or nine patch.
public unsafe BoundingBoxRenderQueue() { var maxVertices = 10_000u; _lines = MemoryUtils.AllocateBlock <Line>(maxVertices); VertexBuffer = GraphicsDevice.BufferManager.Create(new BufferCreation { Type = BufferTypes.VertexBuffer, Count = maxVertices, CpuAccessFlags = D3D11_CPU_ACCESS_FLAG.D3D11_CPU_ACCESS_WRITE, Stride = (uint)sizeof(Line), Usage = D3D11_USAGE.D3D11_USAGE_DYNAMIC }); }
public SpriteBatch(uint maxSprites) { _sprites = MemoryUtils.AllocateBlock <NormalSprite>(maxSprites); }
public EntityManager(WorldConfiguration config) { _worldId = config.Id; _entityIds = new IdContainer(config.MaxEntities); _relationship = MemoryUtils.AllocateBlock <Relationship>(config.MaxEntities, true); }
public TextBatch(uint maxTextBlocks, TextManager textManager, FontManager fontManager) { _textManager = textManager; _fontManager = fontManager; _textBatches = MemoryUtils.AllocateBlock <TextBatchSprite>(maxTextBlocks); }
public NineSliceSpriteBatch(uint maxSprites) { _sprites = MemoryUtils.AllocateBlock <NineSliceSprite>(maxSprites); }
public EntityInfoManager(WorldConfiguration config) { Logger.Trace <EntityInfoManager>($"Creating entity info for {config.MaxEntities} entities."); _entityInfos = MemoryUtils.AllocateBlock <EntityInfo>(config.MaxEntities, true); _worldId = config.Id; }