コード例 #1
0
        public static void Render(bool doRedraw)
        {
            UpdateViewPort();

            if (doRedraw)
            {
                //dispatchEventWith(starling.events.Event.RENDER);
                float scaleX = _viewPort.Width / Stage.StageWidth;
                float scaleY = _viewPort.Height / Stage.StageHeight;

                _painter.NextFrame();
                _painter.PixelSize = 1.0f / ContentScaleFactor;
                _painter.State.SetProjectionMatrix(
                    _viewPort.X < 0f ? -_viewPort.X / scaleX : 0.0f,
                    _viewPort.Y < 0f ? -_viewPort.Y / scaleY : 0.0f,
                    _clippedViewPort.Width / scaleX,
                    _clippedViewPort.Height / scaleY,
                    Stage.StageWidth, Stage.StageHeight, Stage.CameraPosition);

                _painter.Clear(Stage.Color);

                Stage.Render(_painter);
                _painter.FinishFrame();
                _painter.FrameId = ++_frameId;

                _painter.Present();
            }

            if (_statsDisplay != null)
            {
                _statsDisplay.DrawCount = _painter.DrawCount;
                if (!doRedraw)
                {
                    _statsDisplay.MarkFrameAsSkipped();
                }
            }

            if (_enableErrorChecking)
            {
                GPUInfo.CheckForOpenGLError();
            }
        }