Пример #1
0
        public static void Main()
        {
            var builder = new IocBuilder();

            builder.RegisterModules(Assembly.GetExecutingAssembly());

            using (var game = new CedrusGame(builder))
            {
                game.Run();
            }
        }
Пример #2
0
        public CedrusGame(IocBuilder builder)
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            builder.LogRegistrations();
            builder.RegisterModules(Assembly.GetExecutingAssembly(), type => type.FullName.EndsWith("Module"));

            builder.RegisterSingleton(c => graphics.GraphicsDevice);
            builder.RegisterSingleton(c => new GameSettings(Window));
            builder.RegisterSingleton(c => Content);
            EnumerateAssemblies(assembly => builder.RegisterSingletonSubclassesOf(assembly, typeof(CommonAssetBuilder)));

            container = builder.Build();

            gameTimeline = container.Resolve <GameTimeline>();
            Appender     = container.Resolve <IAppender>()[GetType()];
        }