Example #1
0
        public YogaNode()
        {
            YogaLogger.Initialize();

            _ygNode = Native.YGNodeNew();
            if (_ygNode.IsInvalid)
            {
                throw new InvalidOperationException("Failed to allocate native memory");
            }
        }
Example #2
0
        public YogaNode(YogaConfig config)
        {
            YogaLogger.Initialize();

            _ygNode = Native.YGNodeNewWithConfig(config.Handle);
            if (_ygNode.IsInvalid)
            {
                throw new InvalidOperationException("Failed to allocate native memory");
            }
        }
Example #3
0
        private YogaConfig(YGConfigHandle ygConfig)
        {
            _ygConfig = ygConfig;
            if (_ygConfig.IsInvalid)
            {
                throw new InvalidOperationException("Failed to allocate native memory");
            }

            _ygConfig.SetContext(this);

            if (_ygConfig == YGConfigHandle.Default)
            {
                _managedLogger = LoggerInternal;
            }
        }
Example #4
0
        private YogaConfig(YGConfigHandle ygConfig)
        {
            _ygConfig = ygConfig;
            if (_ygConfig.IsInvalid)
            {
                throw new InvalidOperationException("Failed to allocate native memory");
            }

            _ygConfig.SetContext(this);

            if (_ygConfig == YGConfigHandle.Default)
            {
                _managedLogger = LoggerInternal;
#if (!UNITY_WEBGL && !UNITY_ANDROID) || UNITY_EDITOR
                Native.YGInteropSetLogger(_managedLogger);
#endif
            }
        }
Example #5
0
 public static extern void YGInteropSetLogger(
     [MarshalAs(UnmanagedType.FunctionPtr)] YogaLogger logger);