Esempio n. 1
0
 public RenderingSystemIntegrationTestsSut(IAssetStore assetStore, IDebugRenderer debugRenderer, IRenderingBackend renderingBackend,
                                           IRenderingSystem renderingSystem)
 {
     AssetStore       = assetStore;
     DebugRenderer    = debugRenderer;
     RenderingBackend = renderingBackend;
     RenderingSystem  = renderingSystem;
 }
Esempio n. 2
0
        public Engine(
            Configuration configuration,
            IAudioBackend audioBackend,
            IInputBackend inputBackend,
            IRenderingBackend renderingBackend,
            IGame game)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            if (audioBackend == null)
            {
                throw new ArgumentNullException(nameof(audioBackend));
            }
            if (inputBackend == null)
            {
                throw new ArgumentNullException(nameof(inputBackend));
            }
            if (renderingBackend == null)
            {
                throw new ArgumentNullException(nameof(renderingBackend));
            }
            if (game == null)
            {
                throw new ArgumentNullException(nameof(game));
            }

            Log.Info("Initializing engine components.");
            var containerBuilder = new ContainerBuilder();

            CommonModules.RegisterAll(containerBuilder);
            EngineModules.RegisterAll(containerBuilder);

            containerBuilder.RegisterInstance(configuration.Core).As <CoreConfiguration>().SingleInstance();
            containerBuilder.RegisterInstance(configuration.Physics).As <PhysicsConfiguration>().SingleInstance();
            containerBuilder.RegisterInstance(configuration.Rendering).As <RenderingConfiguration>().SingleInstance();

            containerBuilder.RegisterInstance(audioBackend).As <IAudioBackend>().SingleInstance();
            containerBuilder.RegisterInstance(inputBackend).As <IInputBackend>().SingleInstance();
            containerBuilder.RegisterInstance(renderingBackend).As <IRenderingBackend>().SingleInstance();

            var componentsRegistry = new ComponentsRegistry(containerBuilder);

            game.RegisterComponents(componentsRegistry);

            _container     = containerBuilder.Build();
            _lifetimeScope = _container.BeginLifetimeScope();

            RunStartUpTasks();

            _gameLoop      = _lifetimeScope.Resolve <IGameLoop>();
            _engineManager = _lifetimeScope.Resolve <IEngineManager>();
            Log.Info("Engine components initialized.");
        }
Esempio n. 3
0
        public RenderingSystem(IRenderingBackend renderingBackend, RenderingConfiguration renderingConfiguration,
                               IAggregatedDiagnosticInfoProvider aggregatedDiagnosticInfoProvider, IDebugRendererForRenderingSystem debugRendererForRenderingSystem)
        {
            _renderer2D = renderingBackend.Renderer2D;
            _aggregatedDiagnosticInfoProvider = aggregatedDiagnosticInfoProvider;
            _debugRendererForRenderingSystem  = debugRendererForRenderingSystem;

            _renderingConfiguration = renderingConfiguration;
            _sortingLayersOrder     = _renderingConfiguration.SortingLayersOrder.ToList();
            _renderList             = new List <Entity>();
        }
        public void SetUp()
        {
            _renderer2D = Substitute.For <IRenderer2D>();
            _renderer2D.ScreenWidth.Returns(ScreenWidth);
            _renderer2D.ScreenHeight.Returns(ScreenHeight);

            _renderingBackend = Substitute.For <IRenderingBackend>();
            _renderingBackend.Renderer2D.Returns(_renderer2D);
            _aggregatedDiagnosticInfoProvider = Substitute.For <IAggregatedDiagnosticInfoProvider>();
            _debugRendererForRenderingSystem  = Substitute.For <IDebugRendererForRenderingSystem>();
        }
Esempio n. 5
0
 public TextureAssetLoader(IRenderingBackend renderingBackend, IFileSystem fileSystem)
 {
     _renderer2D = renderingBackend.Renderer2D;
     _fileSystem = fileSystem;
 }