Esempio n. 1
0
        /// <summary>
        /// Begin drawing a new frame.<br/>
        /// Calls to NanoVG drawing API should be wrapped in <see cref="BeginFrame(Vector2D{float}, float)"/> and <see cref="EndFrame()"/>.
        /// <para><see cref="BeginFrame(Vector2D{float}, float)"/> defines the size of the window to render to in relation currently
        /// set viewport (i.e. glViewport on GL backends). Device pixel ratio allows to
        /// control the rendering on Hi-DPI devices.</para>
        /// <para>For example, GLFW returns two dimension for an opened window: window size and
        /// frame buffer size. In that case you would set windowWidth / Height to the window size,
        /// devicePixelRatio to: <c>frameBufferWidth / windowWidth</c>.</para>
        /// </summary>
        public void BeginFrame(Vector2D <float> windowSize, float devicePixelRatio)
        {
            fontManager.Pack();

            stateStack.Clear();
            Save();
            Reset();

            pixelRatio.SetDevicePixelRatio(devicePixelRatio);

            renderer.Viewport(windowSize, devicePixelRatio);

            FrameMeta = default;
        }