Beispiel #1
0
        private void RunInstance(int fps, int frames, string title, bool collect)
        {
            var frametimes       = new List <double>(frames);
            var gameParameters   = GameParameters.defaultParameters;
            var initialGameState = GameStateFactory.defaultScenario(gameParameters, 8);
            var game             = new PhotonesProgram(initialGameState,
                                                       (g, e) => {
                frametimes.Add(e.PerformanceStats.FrameTime);
                if (collect)
                {
                    GC.Collect();
                }
                if (e.UpdateEventArgs.Frame > frames)
                {
                    g.Close();
                }
            });

            game.Run(fps);

            DumpFrametimesCsv("frametimes.csv", title, frametimes);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            using (Toolkit.Init(new ToolkitOptions()
            {
                Backend = PlatformBackend.PreferNative
            })) {
                Thread.CurrentThread.CurrentCulture   = CultureInfo.InvariantCulture;
                Thread.CurrentThread.CurrentUICulture = CultureInfo.InvariantCulture;

                var logger = new Logger();

                logger.Info.Log("");
                logger.Info.Log("Creating game");
                var gameParameters = GameParameters.defaultParameters;
                var game           = new PhotonesProgram(GameStateFactory.defaultScenario(gameParameters, 2));
                Utils.Tracer = new Tracer(logger, game._gameStatistics);

                logger.Info.Log("Running game");
                game.Run();

                logger.Info.Log("Safely exited game");
            }
        }