golang-ui / nuklear

This project provides Go bindings for nuklear.h — a small ANSI C GUI library.
https://github.com/vurtun/nuklear
MIT License
1.57k stars 98 forks source link

Main menu items do not appear #68

Closed andydotxyz closed 5 years ago

andydotxyz commented 5 years ago

I have converted some example code from nuklear (C) to nk and I cannot figure out why the menu does not display.

The Menu bar appears, and is clickable. But when it toggles on there is nothing visible on screen...

    nk.NkMenubarBegin(ctx)
    nk.NkLayoutRowBegin(ctx, nk.LayoutStaticRow, 25, 1)
    nk.NkLayoutRowPush(ctx, 45)
    if nk.NkMenuBeginLabel(ctx, "File", nk.TextAlignLeft, nk.NkVec2(120, 200)) > 0 {
        nk.NkLayoutRowDynamic(ctx, 25, 1)
        if nk.NkMenuItemLabel(ctx, "Quit", nk.TextAlignLeft) > 0 {
            win.SetShouldClose(true)
        }

        nk.NkMenuEnd(ctx)
    }
    nk.NkMenubarEnd(ctx)
xlab commented 5 years ago

Hi! I took the example from https://github.com/golang-ui/nuklear/tree/master/cmd/nk-example

and pasted this menu block (after NkBegin): https://gist.github.com/xlab/bf17492dd89abb08c32a9348e6b3c5a6#file-main-go-L97-L107

It works just fine

screen shot 2018-11-26 at 03 25 13

Please try to fill the menu before adding any rows.

andydotxyz commented 5 years ago

Apologies, I found that the cause was that the maxElementBuffer was not enough for the application (changing 1024 to 128 * 1024 fixed it)