SharpDX.Samples.DemoTime.Start C# (CSharp) Method

Start() public method

public Start ( ) : void
return void
        public void Start()
        {
            _stopwatch.Start();
            _lastUpdate = 0;
        }

Usage Example

Esempio n. 1
0
        /// <summary>
        /// Runs the demo.
        /// </summary>
        public void Run(DemoConfiguration demoConfiguration)
        {
            _demoConfiguration = demoConfiguration ?? new DemoConfiguration();
            _form = CreateForm(_demoConfiguration);
            Initialize(_demoConfiguration);

            bool isFormClosed   = false;
            bool formIsResizing = false;

            _form.MouseClick += HandleMouseClick;
            _form.KeyDown    += HandleKeyDown;
            _form.KeyUp      += HandleKeyUp;
            _form.Resize     += (o, args) =>
            {
                if (_form.WindowState != _currentFormWindowState)
                {
                    HandleResize(o, args);
                }

                _currentFormWindowState = _form.WindowState;
            };

            _form.ResizeBegin += (o, args) => { formIsResizing = true; };
            _form.ResizeEnd   += (o, args) =>
            {
                formIsResizing = false;
                HandleResize(o, args);
            };

            _form.Closed += (o, args) => { isFormClosed = true; };

            LoadContent();

            clock.Start();
            BeginRun();
            RenderLoop.Run(_form, () =>
            {
                if (isFormClosed)
                {
                    return;
                }

                OnUpdate();
                if (!formIsResizing)
                {
                    Render();
                }
            });

            UnloadContent();
            EndRun();

            // Dispose explicity
            Dispose();
        }
All Usage Examples Of SharpDX.Samples.DemoTime::Start