Example #1
0
 public ApplicationLoop(RootConfiguration configuration, ProfileCollection profileCollection, IMenuController menuController, IGamePadStateReader stateReader)
 {
     Configuration     = configuration;
     ProfileCollection = profileCollection;
     MenuController    = menuController;
     StateReader       = stateReader;
 }
        public override void Load()
        {
            var simulator = new InputSimulator();

            simulator.Mouse.MouseWheelClickSize = 1;

            Bind <IInputSimulator>().ToConstant(simulator);
            Bind <IKeyboardSimulator>().ToConstant(simulator.Keyboard);
            Bind <IMouseSimulator>().ToConstant(simulator.Mouse);
            Bind <RootConfiguration>().ToConstant(RootConfiguration);
            Bind <IActionFactory>().To <ActionFactory>();
            Bind <IActionFactoryFactory>().ToFactory();
            Bind <IProfileFactory>().To <ProfileFactory>();

            Bind <IGamePadStateReader>().To <GamePadStateReader>().InSingletonScope();
            Bind <ProfileCollection>()
            .ToMethod(ctx => ProfileCollection.FromRootConfiguration(
                          RootConfiguration, ctx.Kernel.Get <IProfileFactory>()))
            .InSingletonScope();
            Bind <ApplicationLoop>().ToSelf().InSingletonScope();
            Bind <IMenuController>()
            .ToMethod(ctx => new MenuController(RootConfiguration, ctx.Kernel.Get <IActionFactoryFactory>()))
            .InSingletonScope();
        }