Hello,

I'm attempting to create bindings for the C library nuklear - 
[https://github.com/vurtun/nuklear](https://github.com/vurtun/nuklear)

Here's the github repo with my bindings - 
[https://github.com/zacharycarter/nuklear-nim](https://github.com/zacharycarter/nuklear-nim)

Here's a description of the problem - 
[https://github.com/vurtun/nuklear/issues/348](https://github.com/vurtun/nuklear/issues/348)

* * *

Hello,

I've created bindings to nuklear for the Nim programming language. They can be 
found here - 
[https://github.com/zacharycarter/nuklear-nim](https://github.com/zacharycarter/nuklear-nim)

The bindings are not complete and there are still a few constructs in nuklear.h 
I have yet to figure out how to port to nim. Regardless, they're mostly 
complete and I'm trying to work up a small example based on the Opengl 3 GLFW3 
demo.

I'm running into a problem though. When I call - nk_begin 
([https://github.com/zacharycarter/nuklear-nim/blob/master/testNuklear.nim#L85](https://github.com/zacharycarter/nuklear-nim/blob/master/testNuklear.nim#L85))
 - in my program, the following assertion fails :

Assertion failed: (!ctx->current && "if this triggers you missed a nk_end 
call"), function nk_begin_titled, file ./nuklear.h, line 17271.

Here's some output from lldb 
    
    
    * thread #1: tid = 0x14966, 0x0000000100001116 
testNuklear`main_mgJNO5hlIp1wZRNie7UREA + 1094 at testNuklear.nim:85, queue = 
'com.apple.main-thread', stop
    reason = breakpoint 3.1
        frame #0: 0x0000000100001116 testNuklear`main_mgJNO5hlIp1wZRNie7UREA + 
1094 at testNuklear.nim:85
       82       glfw.PollEvents()
       83       #nk_glfw3_new_frame()
       84       ##  GUI
    -> 85       if nk_begin(ctx, "Demo", nk_rect(50, 50, 230, 250), nk_flags 
NK_WINDOW_BORDER.cint or
       86           NK_WINDOW_MOVABLE.cint or NK_WINDOW_SCALABLE.cint or 
NK_WINDOW_MINIMIZABLE.cint or
       87           NK_WINDOW_TITLE.cint) == 1:
       88           discard
    (lldb) frame variable ctx0->current
    (nkwindow_F8W9asuU9aVqgjmJLA5nrAQw *) ctx0->current = 0x0000000000000000
    (lldb)
    

I'm not sure why when the C code is invoked - this is no longer the case...

I've added some printf statements to nuklear.h to ensure that the method isn't 
being called twice and failing on a subsequent invocation - it's failing on the 
first call.

I've been tearing my hair out over this - I can't figure out why the context 
isn't null. Is there anything that needs to be done initialization wise, 
besides calling nk_init and setting a default font? I'm reaching for help here 
as I'm guessing most folks here don't know nim, but any suggestions would be 
greatly appreciated!

\---

I'm not sure why this assert fails, anyone have any ideas? I can help folks 
with getting the project checked out / built if they'd like to run it in an 
effort to help me.

Thanks!

-Zachary Carter|   
---|---

Reply via email to