Exemplo n.º 1
0
        public IPromise WaitForTicks <T>(ILinkHandler handle, int ticks) where T : ITimeEvent
        {
            var promise = new Promise();

            FrameTimer <T> timer = null;

            timer = new FrameTimer <T>(ticks,
                                       () =>
            {
                if (handle.IsActive)
                {
                    promise.Resolve();
                }

                timer.Dispose();
            },
                                       () =>
            {
                if (handle.IsDestroyed)
                {
                    timer.Dispose();
                }

                return(handle.IsActive);
            });

            return(promise);
        }
Exemplo n.º 2
0
        public void DestroyInstance()
        {
            _frameTimer.Stop();

            _frameTimer.Dispose();
            _device.Dispose();
            _window.Dispose();
            _device     = null;
            _frameTimer = null;
        }
Exemplo n.º 3
0
 /// <summary>
 /// Disposes of all elements in _sceneResources
 /// </summary>
 public virtual void Dispose()
 {
     _frameTimer.Cancel();
     _graphicsDevice.WaitForIdle();
     foreach (var child in _allChildren)
     {
         child.Dispose();
     }
     _allChildren.Clear();
     _frameTimer.Dispose();
     _factory.DisposeCollector.DisposeAll();
     _graphicsDevice.WaitForIdle();
     _graphicsDevice.Dispose();
     _contextWindow.Close();
 }
Exemplo n.º 4
0
        public void DestroyInstance()
        {
            _frameTimer.Stop();

            //Begin and clear scene to stop last draw sticking on screen
            _device.BeginScene();
            _device.ClearScene();

            _frameTimer.Dispose();
            _device.Dispose();
            _window.Dispose();

            _window     = null;
            _device     = null;
            _frameTimer = null;
        }
Exemplo n.º 5
0
 protected override void OnClosed(EventArgs e)
 {
     base.OnClosed(e);
     Watch.Stop();
     FrameTimer.Dispose();
 }