コード例 #1
0
 public FramebufferToplevelImpl(IOutputBackend outputBackend, IInputBackend inputBackend)
 {
     _outputBackend = outputBackend;
     _inputBackend  = inputBackend;
     Invalidate(default(Rect));
     _inputBackend.Initialize(this, e => Input?.Invoke(e));
 }
コード例 #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.");
        }
コード例 #3
0
 public LinuxFramebufferLifetime(IOutputBackend fb, IInputBackend input)
 {
     _fb           = fb;
     _inputBackend = input;
 }
コード例 #4
0
 public InputSystem(IInputBackend inputBackend)
 {
     _inputProvider = inputBackend.CreateInputProvider();
 }