-
Notifications
You must be signed in to change notification settings - Fork 99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fields of some types are not exported #6
Comments
Hi! Structs in Nuklear have too much inner state, I decided to avoid binding them, except cases when they are simple. Also sometimes it's not good for performance of tiny structs that rarely get changed. See https://github.com/golang-ui/nuklear/blob/master/nk/etc.go I usually write setters and getters for stuff I need to change. You can contribute yours for public fields of ctx.Style().Window().SetBackground(nk.NkRgb(0,120,215)) I think both setters/getters generation can be next feature of cgogen, but that's another story. |
Thanks! I will probably write a few and submit a pull request later on. |
illinoisjackson did you write code about styling window? Could you give example to us? |
I'm stuck here: |
Thanks. |
@Rand99 At this moment, all strings must be NULL-terminated, like Regarding the NkListView, an "unstuck" piece of Go code would look like func (l *ListView) Begin() int {
return (int)(l.begin)
}
func (l *ListView) End() int {
return (int)(l.end)
}
func (l *ListView) Count() int {
return (int)(l.count)
} I added it to |
Thank you for the example. var view nk.ListView
var alist = []string{"asdf", "asdf2", "asdf3"}
nk.NkLayoutRowDynamic(ctx, 90, 1) {
if nk.NkListViewBegin(ctx, &view, "test", nk.WindowBorder, 25, int32(len(alist))) > 0 {
nk.NkLayoutRowDynamic(ctx, 25, 1)
{
for i := 0; i <= view.Count(); i++ {
nk.NkLabel(ctx, alist[view.Begin()+i], nk.TextAlignLeft)
}
}
nk.NkListViewEnd(&view)
}
} It crashes easily and the memory is written in the list :-) I will stick with https://github.com/nelsam/gxui at the moment. |
Like because you ignored my advice to NULL-terminate the strings and are passing them into C without termination. That's a C library either way, the safest way will always be to use native Go packages. The reason why I personally don't stick with GXUI is because I won't commit my time and effort in frozen and unfinished projects, had some bad experience doing that in the past. |
UPD: c-for-go now support safe strings (automatic NULL-termination of all strings), the bindings for Nuklear were updated, so all strings are automatically terminated now. |
I didnt ignore it on purpose. i just didnt get it at 3am after 13 hours of work. i understand your position on gxui. you will attract people and contributers with the same working examples as gxui. |
I tried to change the background color of a window:
ctx.style.window.background = nk.NkRgb(0,120,215)
and when building, Golang stopped with an error saying that
style
was not exported.I'm not sure how you would go about this in cgogen, but I think that the underlying c structs in nuklear.h need to be extracted or modified in some way so that they are exported or capitalized.
The text was updated successfully, but these errors were encountered: