示例#1
0
        public void Start(EngineStartParameters parameters)
        {
            graphicsHost.CreateWindow(new Vector2(1600, 900));

            var mapPath    = parameters.LoadPathOverride ?? @"D:\H2vMaps\lockout.map";
            var configPath = Environment.GetEnvironmentVariable(ConfigurationConstants.ConfigPathOverrideEnvironmentVariable);

            if (configPath != null)
            {
                configPath = Path.GetFullPath(configPath);
            }
            else
            {
                configPath = Environment.CurrentDirectory + "/Configs";
            }

            var matFactory = new MaterialFactory(configPath);

            var factory = new MapFactory(Path.GetDirectoryName(mapPath));

            matFactory.AddListener(() =>
            {
                LoadMap(factory, mapPath, matFactory);
            });

            world = new RealtimeWorld(gameWindowGetter(),
                                      audioHost.GetAudioAdapter(),
                                      graphicsHost);

            LoadMap(factory, mapPath, matFactory);

            gameLoop.RegisterCallbacks(world.Update, world.Render);
            gameLoop.Start(60, 60);
        }
示例#2
0
        static void Main(string[] args)
        {
            try
            {
                var engine    = new Engine();
                var startArgs = new EngineStartParameters();

                if (args.Length > 0)
                {
                    startArgs.LoadPathOverride = args[0];
                }

                engine.Start(startArgs);
            }
            catch (Exception e)
            {
                File.WriteAllText("error.txt", e.ToString());
                throw;
            }
        }