Exemplo n.º 1
0
        public async Task InitializeAsync()
        {
            using (var session = _performanceProfiler.CreateSession())
            {
                _scene.FpsChanged += SceneOnFpsChanged;
                var sceneContainer = await _scenePersistenceService.LoadScene2DAsync();

                if (sceneContainer == null)
                {
                    var triangle = new Triangle2D(
                        new Vector2D(-50, -50),
                        new Vector2D(0, 50),
                        new Vector2D(50, -50),
                        GetNextColor());

                    _scene.Append(triangle);
                    await _scene.BeginShiftAsync(0, 0);

                    await _scene.EndShiftAsync(_width / 2, _height / 2);

                    return;
                }

                _scene.FromScene2Ds(sceneContainer);
                await _scene.RenderAsync();

                session.LogWithPerformance("2D scene loaded");
            }
        }
Exemplo n.º 2
0
 public Task RenderAsync()
 {
     ProjectSceneTo2D();
     return(_scene2D.RenderAsync());
 }