コード例 #1
0
ファイル: EventManager.cs プロジェクト: Golle/Titan
        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);
        }
コード例 #2
0
    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.
コード例 #3
0
ファイル: BoundingBoxRenderQueue.cs プロジェクト: Golle/Titan
        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
            });
        }
コード例 #4
0
 public SpriteBatch(uint maxSprites)
 {
     _sprites = MemoryUtils.AllocateBlock <NormalSprite>(maxSprites);
 }
コード例 #5
0
 public EntityManager(WorldConfiguration config)
 {
     _worldId      = config.Id;
     _entityIds    = new IdContainer(config.MaxEntities);
     _relationship = MemoryUtils.AllocateBlock <Relationship>(config.MaxEntities, true);
 }
コード例 #6
0
 public TextBatch(uint maxTextBlocks, TextManager textManager, FontManager fontManager)
 {
     _textManager = textManager;
     _fontManager = fontManager;
     _textBatches = MemoryUtils.AllocateBlock <TextBatchSprite>(maxTextBlocks);
 }
コード例 #7
0
ファイル: NineSliceSpriteBatch.cs プロジェクト: Golle/Titan
 public NineSliceSpriteBatch(uint maxSprites)
 {
     _sprites = MemoryUtils.AllocateBlock <NineSliceSprite>(maxSprites);
 }
コード例 #8
0
 public EntityInfoManager(WorldConfiguration config)
 {
     Logger.Trace <EntityInfoManager>($"Creating entity info for {config.MaxEntities} entities.");
     _entityInfos = MemoryUtils.AllocateBlock <EntityInfo>(config.MaxEntities, true);
     _worldId     = config.Id;
 }