Renderer that supports UI layout. 支持2D UI布局的渲染器
Example #1
0
 private void DisposeUI(UIRenderer uiRenderer)
 {
     uiRenderer.Dispose();
     UIRenderer[] array = uiRenderer.Children.ToArray();
     foreach (UIRenderer child in array)
     {
         DisposeUI(child);
     }
 }
Example #2
0
 private void DisposeUI(UIRenderer uiRenderer)
 {
     uiRenderer.Dispose();
     UIRenderer[] array = uiRenderer.Children.ToArray();
     foreach (UIRenderer child in array)
     {
         DisposeUI(child);
     }
 }
Example #3
0
 private void DisposeUI(UIRenderer uiRenderer)
 {
     uiRenderer.Dispose();
     ITreeNode[] array = uiRenderer.Children.ToArray();
     foreach (ITreeNode child in array)
     {
         DisposeUI(child as UIRenderer);
     }
 }
Example #4
0
        /// <summary>
        /// Gets projection matrix for <see cref="ILayout&lt;T&gt;"/> to layout controls in OpenGL canvas.
        /// </summary>
        /// <param name="uiRenderer"></param>
        /// <returns></returns>
        public static mat4 GetOrthoProjection(this UIRenderer uiRenderer)
        {
            float halfWidth  = uiRenderer.Size.Width / 2.0f;
            float halfHeight = uiRenderer.Size.Height / 2.0f;

            //float halfDepth = Math.Max(halfWidth, halfHeight);
            //halfDepth = Math.Max(halfDepth, Math.Abs(uiRenderer.zNear));
            //halfDepth = Math.Max(halfDepth, Math.Abs(uiRenderer.zFar));
            return(glm.ortho(-halfWidth, halfWidth, -halfHeight, halfHeight,
                             uiRenderer.zNear, uiRenderer.zFar));
        }
Example #5
0
//#if DEBUG
//        private int stackLevel = 0;
//#endif

        private void RenderUIRenderer(UIRenderer renderer, RenderEventArgs arg)
        {
//#if DEBUG
//            stackLevel++;
//            if (stackLevel > ushort.MaxValue)
//            { throw new Exception(string.Format("Maybe circular reference in UI tree!")); }
//#endif
            renderer.Render(arg);
            foreach (var item in renderer.Children)
            {
                RenderUIRenderer(item, arg);
            }
//#if DEBUG
//            stackLevel--;
//#endif
        }
Example #6
0
 //#if DEBUG
 //        private int stackLevel = 0;
 //#endif
 private void RenderUIRenderer(UIRenderer renderer, RenderEventArgs arg)
 {
     //#if DEBUG
     //            stackLevel++;
     //            if (stackLevel > ushort.MaxValue)
     //            { throw new Exception(string.Format("Maybe circular reference in UI tree!")); }
     //#endif
     renderer.Render(arg);
     UIRenderer[] array = renderer.Children.ToArray();
     foreach (UIRenderer item in array)
     {
         RenderUIRenderer(item, arg);
     }
     //#if DEBUG
     //            stackLevel--;
     //#endif
 }