예제 #1
0
        private void SKGLView_PaintSurface(object sender, SKPaintGLSurfaceEventArgs e)
        {
            if (_isInitiated)
            {
                e.Surface.Canvas.Clear(new SKColor(0, 0, 0));
                _testView.Render();

                var fps = 1000 / (_stopwatch.ElapsedMilliseconds - _lastElapsedTime);
                _lastElapsedTime = _stopwatch.ElapsedMilliseconds;

                _testView.UpdateFps(fps);
            }
            else
            {
                // Init SkiaSharp
                _canvas   = e.Surface.Canvas;
                _testView = new TestView(0, 0, e.Surface.Canvas.ClipBounds.Height, e.Surface.Canvas.ClipBounds.Width);
                _testView.SetCanvas(e.Surface.Canvas);
                _testView.Initialize();
                _isInitiated = true;
                _stopwatch   = new Stopwatch();
                _stopwatch.Start();
            }
        }