Пример #1
0
 public void Init(RendererConfig config)
 {
     this.config        = config;
     this.directoryPath = config.Directory;
     try
     {
         watcher = new FileSystemWatcher(directoryPath);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
         return;
     }
     watcher.Filter = "*.bmp";
     watcher.EnableRaisingEvents = true;
     watcher.Created            += watcher_Created;
     watcher.Deleted            += watcher_Deleted;
     if (config.UpdateFrequency == 0)
     {
         config.UpdateFrequency = 100;
     }
     timer          = new System.Timers.Timer(1000 / config.UpdateFrequency);
     timer.Elapsed += timer_Elapsed;
     timer.Start();
 }
Пример #2
0
 public void Init(RendererConfig config)
 {
     this.config = config;
     dirInfo     = new DirectoryInfo(config.Directory);
     if (config.Cleanup)
     {
         try
         {
             foreach (FileInfo file in dirInfo.GetFiles())
             {
                 file.Delete();
             }
         }
         catch (Exception e)
         {
             //
         }
     }
     if (config.UpdateFrequency > 0)
     {
         frameTime = 1000 / config.UpdateFrequency;
     }
     pullThread   = new System.Threading.Thread(() => { PullRun(); });
     renderThread = new System.Threading.Thread(() => { RenderRun(); });
     pullThread.Start();
     renderThread.Start();
 }
Пример #3
0
 public void Init(RendererConfig config)
 {
     this.config = config;
     dirInfo     = new DirectoryInfo(config.Directory);
     SetInterval();
     puller.Elapsed += puller_Elapsed;
     puller.Start();
 }
Пример #4
0
            public override void Validate()
            {
                if (RendererConfig == null)
                {
                    throw new Exception("RendererConfig must not be null");
                }
                if (WindowConfig == null)
                {
                    throw new Exception("WindowConfig must not be null");
                }

                RendererConfig.Validate();
                WindowConfig.Validate();
            }
Пример #5
0
        protected override void Initialize()
        {
            base.Initialize();
            DataLoader.RegisterParser(
                StandardGameObjectParser.For <TileMapObject>(),
                StandardGameObjectParser.For <EntityObject>(),
                StandardGameObjectParser.For <NPCObject>()
                );
            BoxingViewportAdapter viewport_adapter = new BoxingViewportAdapter(Window, GraphicsDevice, Width, Height);

            renderer = new Renderer(viewport_adapter, Content);
            PushWorld("level01.json");

            RendererConfig config = new RendererConfig();

            config.AddParam("fps");
            renderer.UpdateConfig(config);
        }