Exemple #1
0
        public static nk_context *Init()
        {
            var loader = new Squared.Util.EmbeddedDLLLoader(Assembly.GetExecutingAssembly());

            loader.Load("nuklear.dll");

            _OnNuklearAssert = OnNuklearAssert;
            Nuklear.nk_set_assert_handler(_OnNuklearAssert);

            // TODO: Free these later
            var ctx = (nk_context *)ManagedAlloc(sizeof(nk_context));

            Allocator   = MakeAllocator();
            NullTexture = (nk_draw_null_texture *)ManagedAlloc(sizeof(nk_draw_null_texture));
            Commands    = (nk_buffer *)ManagedAlloc(sizeof(nk_buffer));

            Nuklear.nk_init(ctx, Allocator, null);

            Nuklear.nk_buffer_init(Commands, Allocator, new IntPtr(4 * 1024));

            return(ctx);
        }