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

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

            _ygNode = Native.YGNodeNewWithConfig(config.Handle);
            if (_ygNode.IsInvalid)
            {
                throw new InvalidOperationException("Failed to allocate native memory");
            }
        }
Beispiel #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;
            }
        }
Beispiel #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
            }
        }
Beispiel #5
0
 public static extern void YGInteropSetLogger(
     [MarshalAs(UnmanagedType.FunctionPtr)] YogaLogger logger);