This project provides Go bindings for nuklear.h — a small ANSI C GUI library.

Nuklear version-2.00.6 GoDoc

Package nk provides Go bindings for nuklear.h — a small ANSI C gui library. See github.com/vurtun/nuklear.
All the binding code has automatically been generated with rules defined in nk.yml.

There is no idiomatic wrapper package that will make things easier to use, but the original API is pretty straightforward. The nk package is fine for the start, then we'll figure out something better that just a wrapper.

Features (plain C version)

  • Immediate mode graphical user interface toolkit
  • Single header library
  • Written in C89 (ANSI C)
  • Small codebase (~15kLOC)
  • Focus on portability, efficiency and simplicity
  • No dependencies (not even the standard library if not wanted)
  • Fully skinnable and customizable
  • Low memory footprint with total memory control if needed or wanted
  • UTF-8 support
  • No global or hidden state
  • Customizable library modules (you can compile and use only what you need)
  • Optional font baker and vertex buffer output

About nuklear.h

This is a minimal state immediate mode graphical user interface single header toolkit written in ANSI C and licensed under public domain. It was designed as a simple embeddable user interface for application and does not have any dependencies, a default render backend or OS window and input handling but instead provides a very modular library approach by using simple input state for input and draw commands describing primitive shapes as output. So instead of providing a layered library that tries to abstract over a number of platform and render backends it only focuses on the actual UI.

Overview

nuklear golang architecture

Your Go application runs a loop where it handles input from the platform and manages the rendering backend. It uses Nuklear API bindings (the nk package) to run UI commands for layout and event handling. Nuklear maintains a draw command list that is consumed by one of the rendering backends so the UI is displayed. In this case, a C program is being a middleman that does all the UI heavylifting for us, so we can focus on the application logic, event handling and drawing backends in Go.

Installation of nk

Supported platforms are:

  • Windows 32-bit
  • Windows 64-bit
  • OS X
  • Linux
  • Android

The desktop support is achieved using GLFW and there are backends written in Go for OpenGL 2.1 and OpenGL 3.2. Thanks to strangebroadcasts it also has SDL2 support now.

Android support is added using the android-go project, there is a corresponding backend for OpenGL ES 2.0 or 3.0 surface and input handling logic. Sophisticated things like scroll gestures will be added later.

Desktop installation

Debian/Ubuntu dependencies: (Header files required for GLFW)

# apt install xorg-dev

Fedora(tested on 28):

# libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel mesa-libGL-devel libXi-devel

After that, standard go get should work:

$ go get github.com/golang-ui/nuklear/nk

On desktop both OpenGL 2.1 and OpenGL 3.2 contexts are working fine, but by default OpenGL 3.2-core is used, to compile with OpenGL 2.1 support instead. The 2.1 backend is for legacy hardware or VMs like Parallels.

$ go get -tags opengl2 github.com/golang-ui/nuklear/nk

Additional steps for Windows users:

  1. Get MinGW compiler toolchain and MSYS via MinGW installer;
  2. Open MSYS shell (usually C:\MinGW\msys\1.0\msys.bat);

Then everything should go smooth.

$ go version
go version go1.6.2 windows/386

$ gcc -v
COLLECT_GCC=C:\MinGW\bin\gcc.exe
Thread model: posix
gcc version 5.3.0 (GCC)

$ go install github.com/golang-ui/nuklear/nk

Hint: use -tags sdl2 to run with SDL2 instead of GLFW. SDL2 requires additional installation process, see SDL2. Use GLFW if you want to stay go-get-able.

Android demo

In order run Android demo app nk-android make sure that you've prepared your environent as described in plain example Android app. Namely you need to install Android SDK, tools and run make toolchain:

$ cd $GOPATH/src/github.com/golang-ui/nuklear/cmd/nk-android
$ make toolchain # need to run once

# the regular routine:
$ make
$ make install
$ make listen

  

Click for video

Desktop demo

There is an example app nk-example that shows the usage of Nuklear GUI library, based on the official demos.

$ go get github.com/golang-ui/nuklear/cmd/nk-example

$ nk-example
2016/09/23 23:13:09 glfw: created window 400x500
2016/09/23 23:13:10 [INFO] button pressed!
2016/09/23 23:13:10 [INFO] button pressed!
2016/09/23 23:13:10 [INFO] button pressed!

demo screenshot nuklear

Another more realistic Go application that uses Nuklear to do its GUI, a simple WebM player:

nuklear screenshot webm

Rebuilding the package

You will need to get the c-for-go tool installed first.

$ git clone https://github.com/golang-ui/nuklear && cd nuklear
$ make clean
$ make

License

All the code except when stated otherwise is licensed under the MIT license. Nuklear (ANSI C version) is in public domain, authored from 2015-2016 by Micha Mettke.

Comments
  • building and running on osx issues

    building and running on osx issues

    I am trying to do a build of the example, but got a small issue

    
    x-MacBook-Pro:nk-example apple$ pwd
    /Users/apple/workspace/go/src/github.com/golang-ui/nuklear/cmd/nk-example
    x-MacBook-Pro:nk-example apple$ go run main.go
    # github.com/golang-ui/nuklear/nk
    ld: library not found for -lglfw3
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    
    

    so, i tried to do a build form root, but make fails because it cant find cgogen. where can i get cgogen ?

    x-MacBook-Pro:nuklear apple$ pwd
    /Users/apple/workspace/go/src/github.com/golang-ui/nuklear
    x-MacBook-Pro:nuklear apple$ make
    cgogen nk.yml
    make: cgogen: No such file or directory
    make: *** [all] Error 1
    

    __

    Also i checked that glfw works so we knows that good.

    x-MacBook-Pro:nuklear apple$ cd $GOPATH/src/github.com/go-gl/glfw/v3.2/glfw
    x-MacBook-Pro:glfw apple$ pwd
    /Users/apple/workspace/go/src/github.com/go-gl/glfw/v3.2/glfw
    x-MacBook-Pro:glfw apple$ ls
    GLFW_C_REVISION.txt	c_glfw_windows.go	glfw.go			native_darwin.go	vulkan.go
    build.go		context.go		input.c			native_linbsd.go	window.c
    c_glfw.go		error.c			input.go		native_windows.go	window.go
    c_glfw_darwin.go	error.go		monitor.c		time.go
    c_glfw_linbsd.go	glfw			monitor.go		util.go
    x-MacBook-Pro:glfw apple$ go get -u github.com/go-gl/glfw/v3.2/glfw
    x-MacBook-Pro:glfw apple$ pwd
    /Users/apple/workspace/go/src/github.com/go-gl/glfw/v3.2/glfw
    x-MacBook-Pro:glfw apple$ cd ..
    x-MacBook-Pro:v3.2 apple$ pwd
    /Users/apple/workspace/go/src/github.com/go-gl/glfw/v3.2
    x-MacBook-Pro:v3.2 apple$ cd ..
    x-MacBook-Pro:glfw apple$ pwd
    /Users/apple/workspace/go/src/github.com/go-gl/glfw
    x-MacBook-Pro:glfw apple$ code .
    x-MacBook-Pro:glfw apple$ go run main.go
    x-MacBook-Pro:glfw apple$ WORKS ! Can see blank screen...
    
    
  • can't run nk-example

    can't run nk-example

    Hi,

    nk-example crash on my workstation, which infos can I provide to help debugging this issue ?

    `[forth@mjolnir nk-example]$ go build -v github.com/golang-ui/glfw github.com/golang-ui/nuklear/nk

    github.com/golang-ui/nuklear/nk

    In file included from ../../nk/impl_glfw.go:16:0: ../../nk/nuklear_glfw_gl3.h: Dans la fonction ‘nk_glfw3_render’: ../../nk/nuklear_glfw_gl3.h:242:18: attention : assignment makes pointer from integer without a cast [-Wint-conversion] vertices = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); ^ ../../nk/nuklear_glfw_gl3.h:243:18: attention : assignment makes pointer from integer without a cast [-Wint-conversion] elements = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY); ^ github.com/golang-ui/nuklear/cmd/nk-example`

    `[forth@mjolnir nk-example]$ ./nk-example 2016/09/27 11:47:04 glfw: created window 400x500 fatal error: unexpected signal during runtime execution [signal SIGSEGV: segmentation violation code=0x1 addr=0x5d8cc002 pc=0x4f7098]

    runtime stack: runtime.throw(0x57e87b, 0x2a) /usr/lib/go/src/runtime/panic.go:566 +0x95 runtime.sigpanic() /usr/lib/go/src/runtime/sigpanic_unix.go:12 +0x2cc

    goroutine 1 [syscall, locked to thread]: runtime.cgocall(0x51a210, 0xc42004dae8, 0xc400000000) /usr/lib/go/src/runtime/cgocall.go:131 +0x110 fp=0xc42004da98 sp=0xc42004da58 github.com/golang-ui/nuklear/nk._Cfunc_nk_glfw3_render(0x8000000000001, 0x3f80000000020000) ??:0 +0x45 fp=0xc42004dae8 sp=0xc42004da98 github.com/golang-ui/nuklear/nk.NkGLFW3Render(0x8000000000001, 0x3f80000000020000) /home/forth/go/src/github.com/golang-ui/nuklear/nk/nk.go:3482 +0x39 fp=0xc42004db08 sp=0xc42004dae8 main.gfxMain(0x22a8090, 0x834bb0, 0xc42000c3c0) /home/forth/go/src/github.com/golang-ui/nuklear/cmd/nk-example/main.go:145 +0x2ba fp=0xc42004dd18 sp=0xc42004db08 main.main() /home/forth/go/src/github.com/golang-ui/nuklear/cmd/nk-example/main.go:87 +0x652 fp=0xc42004df48 sp=0xc42004dd18 runtime.main() /usr/lib/go/src/runtime/proc.go:183 +0x1f4 fp=0xc42004dfa0 sp=0xc42004df48 runtime.goexit() /usr/lib/go/src/runtime/asm_amd64.s:2086 +0x1 fp=0xc42004dfa8 sp=0xc42004dfa0

    goroutine 17 [syscall, locked to thread]: runtime.goexit() /usr/lib/go/src/runtime/asm_amd64.s:2086 +0x1

    goroutine 5 [syscall]: os/signal.signal_recv(0x0) /usr/lib/go/src/runtime/sigqueue.go:116 +0x157 os/signal.loop() /usr/lib/go/src/os/signal/signal_unix.go:22 +0x22 created by os/signal.init.1 /usr/lib/go/src/os/signal/signal_unix.go:28 +0x41

    goroutine 6 [select, locked to thread]: runtime.gopark(0x589010, 0x0, 0x57579a, 0x6, 0x18, 0x2) /usr/lib/go/src/runtime/proc.go:259 +0x13a runtime.selectgoImpl(0xc42002a730, 0x0, 0x18) /usr/lib/go/src/runtime/select.go:423 +0x11d9 runtime.selectgo(0xc42002a730) /usr/lib/go/src/runtime/select.go:238 +0x1c runtime.ensureSigM.func1() /usr/lib/go/src/runtime/signal1_unix.go:304 +0x2f3 runtime.goexit() /usr/lib/go/src/runtime/asm_amd64.s:2086 +0x1

    goroutine 7 [select]: github.com/xlab/closer.(*closer).wait(0xc42007a000) /home/forth/go/src/github.com/xlab/closer/closer.go:102 +0x2a2 created by github.com/xlab/closer.newCloser /home/forth/go/src/github.com/xlab/closer/closer.go:94 +0x262`

  • Fields of some types are not exported

    Fields of some types are not exported

    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.

  • Making scatter plot graph

    Making scatter plot graph

    I'm attempting to write an interactive scatter plot graph. Currently I don't see a chart type for it yet, hence i'm trying draw the dots/data points on a canvas. However I found difficulties in rendering many dots.

    a) There are occasional glitches when trying to render many elements. My code below is mostly based on cmd/nk-example/main.go with the gfxmain() containing below loop

           if nk.NkBegin(ctx, "Title", bounds, nk.WindowTitle|nk.WindowNoScrollbar) > 0 {
    		canvas := nk.NkWindowGetCanvas(ctx)
    		for fy := 50; fy <= 450; fy += 10 {
    			for fx := 50; fx <= 450; fx += 10 {
    				c1 := nk.NkRect(float32(fx), float32(fy), 5.0, 5.0)
    				nk.NkFillCircle(canvas, c1, nk.NkRgb(171, 239, 29))
    			}
    		}
    	}
    	nk.NkEnd(ctx)
    

    I found a related vurtun/nuklear/issue 419, but failed to find the equivalent control for glDrawElements through the go binding.

    b) The number of dots that can be drawn are restricted by the value of maxVertexBuffer and maxElementBuffer. The scatter plot application wouldn't know the data (how many dots would be).

    Is there an example on how to solve the above points ? or perhaps advice or suggestions on what should I do ?
    I'm not an expert in GL, only knows basic concepts along with some experience in Qt. I'd appreciate any help, thank you.

  • Closing

    Closing "Window" and title collision?

    Hey,

    So, this is might not be this libary's problem, although, it might need some additional functions to expose more things, such as a func (p *Panel) IsClosed().

    But the owner of the other repo doesn't seem all that active, so I thought I post here too as you are more active and could possible help me out.

    So, what say you about this: https://github.com/vurtun/nuklear/issues/361 ?

    Thanks!

  • Building doesn't work on Windows

    Building doesn't work on Windows

    Wanted to try this on Windows and after running: go get github.com/golang-ui/nuklear/nk it gave me:

    # github.com/golang-ui/nuklear/nk
    In file included from Go\src\github.com\golang-ui\nuklear\nk\cgo_helpers.go:11:0:
    ./nuklear_glfw_gl3.h:16:24: fatal error: GLFW/glfw3.h: No such file or directory
    
     #include <GLFW/glfw3.h>
                            ^
    compilation terminated.
    

    I have GLFW 3.2 for Goinstalled and I am using go1.7.3 windows/amd64. Also I have MinGW_x64 installed and added to path.

    To troubleshoot I copied folder containing missing file: %GOPATH%\src\github.com\go-gl\glfw\v3.2\glfw\glfw\include\GLFW to nuklear folder: %GOPATH%\src\github.com\golang-ui\nuklear\nk and building started to throw those errors:

    # github.com/golang-ui/nuklear/nk
    In file included from Go\src\github.com\golang-ui\nuklear\nk\impl_glfw.go:16:0:
    ./nuklear_glfw_gl3.h: In function 'nk_glfw3_device_create':
    ./nuklear_glfw_gl3.h:94:18: error: unknown type name 'GLchar'
         static const GLchar *vertex_shader =
                      ^~~~~~
    ./nuklear_glfw_gl3.h:107:18: error: unknown type name 'GLchar'
         static const GLchar *fragment_shader =
                      ^~~~~~
    ./nuklear_glfw_gl3.h:121:37: error: 'GL_VERTEX_SHADER' undeclared (first use in
    this function)
         dev->vert_shdr = glCreateShader(GL_VERTEX_SHADER);
                                         ^~~~~~~~~~~~~~~~
    ./nuklear_glfw_gl3.h:121:37: note: each undeclared identifier is reported only o
    nce for each function it appears in
    ./nuklear_glfw_gl3.h:122:37: error: 'GL_FRAGMENT_SHADER' undeclared (first use i
    n this function)
         dev->frag_shdr = glCreateShader(GL_FRAGMENT_SHADER);
                                         ^~~~~~~~~~~~~~~~~~
    ./nuklear_glfw_gl3.h:127:35: error: 'GL_COMPILE_STATUS' undeclared (first use in
     this function)
         glGetShaderiv(dev->vert_shdr, GL_COMPILE_STATUS, &status);
                                       ^~~~~~~~~~~~~~~~~
    ./nuklear_glfw_gl3.h:134:31: error: 'GL_LINK_STATUS' undeclared (first use in th
    is function)
         glGetProgramiv(dev->prog, GL_LINK_STATUS, &status);
                                   ^~~~~~~~~~~~~~
    ./nuklear_glfw_gl3.h:155:22: error: 'GL_ARRAY_BUFFER' undeclared (first use in t
    his function)
             glBindBuffer(GL_ARRAY_BUFFER, dev->vbo);
                          ^~~~~~~~~~~~~~~
    ./nuklear_glfw_gl3.h:156:22: error: 'GL_ELEMENT_ARRAY_BUFFER' undeclared (first
    use in this function)
             glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, dev->ebo);
                          ^~~~~~~~~~~~~~~~~~~~~~~
    ./nuklear_glfw_gl3.h: In function 'nk_glfw3_render':
    ./nuklear_glfw_gl3.h:215:21: error: 'GL_FUNC_ADD' undeclared (first use in this
    function)
         glBlendEquation(GL_FUNC_ADD);
                         ^~~~~~~~~~~
    ./nuklear_glfw_gl3.h:220:21: error: 'GL_TEXTURE0' undeclared (first use in this
    function)
         glActiveTexture(GL_TEXTURE0);
                         ^~~~~~~~~~~
    ./nuklear_glfw_gl3.h:235:22: error: 'GL_ARRAY_BUFFER' undeclared (first use in t
    his function)
             glBindBuffer(GL_ARRAY_BUFFER, dev->vbo);
                          ^~~~~~~~~~~~~~~
    ./nuklear_glfw_gl3.h:236:22: error: 'GL_ELEMENT_ARRAY_BUFFER' undeclared (first
    use in this function)
             glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, dev->ebo);
                          ^~~~~~~~~~~~~~~~~~~~~~~
    ./nuklear_glfw_gl3.h:238:64: error: 'GL_STREAM_DRAW' undeclared (first use in th
    is function)
             glBufferData(GL_ARRAY_BUFFER, max_vertex_buffer, NULL, GL_STREAM_DRAW);
    
                                                                    ^~~~~~~~~~~~~~
    ./nuklear_glfw_gl3.h:242:49: error: 'GL_WRITE_ONLY' undeclared (first use in thi
    s function)
             vertices = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
    

    This project looks like what I need so please help me make it work.

  • undefined reference to `__assert_func'

    undefined reference to `__assert_func'

    Hi,

    when go building nk-example on Win10 64 bits using go 1.8.3, the following error log appears:

    C:\Go\PATH\src\github.com\golang-ui\nuklear\cmd\nk-example>go build
    # github.com/golang-ui/nuklear/cmd/nk-example
    C:\Go\pkg\tool\windows_amd64\link.exe: running gcc failed: exit status 1
    C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000001.o: In function `glfwSwapBuffers':
    C:\Go\PATH\src\github.com\go-gl\glfw\v3.2\glfw/glfw/src/context.c:609: undefined reference to `__assert_func'
    C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000001.o: In function `glfwExtensionSupported':
    C:\Go\PATH\src\github.com\go-gl\glfw\v3.2\glfw/glfw/src/context.c:642: undefined reference to `__assert_func'
    C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000001.o: In function `glfwGetProcAddress':
    C:\Go\PATH\src\github.com\go-gl\glfw\v3.2\glfw/glfw/src/context.c:707: undefined reference to `__assert_func'
    C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000001.o: In function `glfwGetInputMode':
    C:\Go\PATH\src\github.com\go-gl\glfw\v3.2\glfw/glfw/src/input.c:153: undefined reference to `__assert_func'
    C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000001.o: In function `glfwSetInputMode':
    C:\Go\PATH\src\github.com\go-gl\glfw\v3.2\glfw/glfw/src/input.c:174: undefined reference to `__assert_func'
    C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000001.o:C:\Go\PATH\src\github.com\go-gl\glfw\v3.2\glfw/glfw/src/input.c:262: more undefined references to `__assert_func' follow
    C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000002.o: In function `_cgo_2daa1da745f8_C2func_calloc':
    /c/Go/PATH/src/github.com/golang-ui/nuklear/nk/cgo-gcc-prolog:42: undefined reference to `__errno'
    /c/Go/PATH/src/github.com/golang-ui/nuklear/nk/cgo-gcc-prolog:44: undefined reference to `__errno'
    C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000002.o: In function `nk_insert_window':
    C:\Go\PATH\src\github.com\golang-ui\nuklear\nk/nuklear.h:18401: undefined reference to `__assert_func'
    C:\Go\PATH\src\github.com\golang-ui\nuklear\nk/nuklear.h:18402: undefined reference to `__assert_func'
    C:\Go\PATH\src\github.com\golang-ui\nuklear\nk/nuklear.h:18396: undefined reference to `__assert_func'
    C:\Go\PATH\src\github.com\golang-ui\nuklear\nk/nuklear.h:18395: undefined reference to `__assert_func'
    C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000002.o: In function `nk_do_button':
    C:\Go\PATH\src\github.com\golang-ui\nuklear\nk/nuklear.h:14036: undefined reference to `__assert_func'
    C:\Users\Saad\AppData\Local\Temp\go-link-061616495\000002.o:C:\Go\PATH\src\github.com\golang-ui\nuklear\nk/nuklear.h:14038: more undefined references to `__assert_func' follow
    collect2.exe: error: ld returned 1 exit status
    

    System info:

    go version go1.8.3 windows/amd64

    >gcc -v
    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/7.1.0/lto-wrapper.exe
    Target: x86_64-w64-mingw32
    Configured with: ../gcc-7.1.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,objc,obj-c++,fortran,ada --enable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Rev2, Built by MSYS2 project' --with-bugurl=https://sourceforge.net/projects/msys2 --with-gnu-as --with-gnu-ld
    Thread model: posix
    gcc version 7.1.0 (Rev2, Built by MSYS2 project)
    
  • Doesn't work or install on windwos

    Doesn't work or install on windwos

    Hi,

    follows errors on build

    # github.com/golang-ui/nuklear/nk
    In file included from src\github.com\golang-ui\nuklear\nk\cgo_helpers.go:11:0:
    ./nuklear_glfw_gl2.h:16:24: fatal error: GLFW/glfw3.h: No such file or directory
    compilation terminated.
    
    C:\goworkspace>go get -x github.com/golang-ui/nuklear/nk
    WORK=C:\Users\Marc\AppData\Local\Temp\go-build622038790
    mkdir -p $WORK\github.com\golang-ui\nuklear\nk\_obj\
    mkdir -p $WORK\github.com\golang-ui\nuklear\
    cd c:\goworkspace\src\github.com\golang-ui\nuklear\nk
    CGO_LDFLAGS="-g" "-O2" "-lglfw3" "-lopengl32" "-lgdi32" "-lm" "-Wl,--allow-multiple-definition" "C:\\Go\\pkg\\tool\\windows_amd64\\cgo.exe" -objdir "C:\\Users\\Marc\\AppData\\Local\\Temp\\go-build622038790\\github.com\\golang-ui\\nuklear\\nk\\_obj\\" -importpath github.com/golang-ui/nuklear/nk -- -I "C:\\Users\\Marc\\AppData\\Local\\Temp\\go-build622038790\\github.com\\golang-ui\\nuklear\\nk\\_obj\\" -g -O2 -DNK_INCLUDE_FIXED_TYPES -DNK_INCLUDE_STANDARD_IO -DNK_INCLUDE_DEFAULT_ALLOCATOR -DNK_INCLUDE_FONT_BAKING -DNK_INCLUDE_DEFAULT_FONT -Wno-implicit-function-declaration -DNK_INCLUDE_FIXED_TYPES -DNK_INCLUDE_STANDARD_IO -DNK_INCLUDE_DEFAULT_ALLOCATOR -DNK_INCLUDE_FONT_BAKING -DNK_INCLUDE_DEFAULT_FONT -Wno-implicit-function-declaration -DNK_INCLUDE_FIXED_TYPES -DNK_INCLUDE_STANDARD_IO -DNK_INCLUDE_DEFAULT_ALLOCATOR -DNK_INCLUDE_FONT_BAKING -DNK_INCLUDE_DEFAULT_FONT -DNK_INCLUDE_VERTEX_BUFFER_OUTPUT -D_GLFW_WIN32 -DNK_INCLUDE_FIXED_TYPES -DNK_INCLUDE_STANDARD_IO -DNK_INCLUDE_DEFAULT_ALLOCATOR -DNK_INCLUDE_FONT_BAKING -DNK_INCLUDE_DEFAULT_FONT -Wno-implicit-function-declaration -DNK_INCLUDE_FIXED_TYPES -DNK_INCLUDE_STANDARD_IO -DNK_INCLUDE_DEFAULT_ALLOCATOR -DNK_INCLUDE_FONT_BAKING -DNK_INCLUDE_DEFAULT_FONT -Wno-implicit-function-declaration cgo_helpers.go color.go const.go font.go impl_glfw.go nk.go types.go
    # github.com/golang-ui/nuklear/nk
    In file included from src\github.com\golang-ui\nuklear\nk\cgo_helpers.go:11:0:
    ./nuklear_glfw_gl2.h:16:24: fatal error: GLFW/glfw3.h: No such file or directory
    compilation terminated.
    

    MinGW-W64 is installed

    Using built-in specs.
    COLLECT_GCC=gcc
    COLLECT_LTO_WRAPPER=C:/mingw-w64/x86_64-5.3.0-posix-seh-rt_v4-rev0/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/5.3.0/lto-wrapper.exe
    Target: x86_64-w64-mingw32
    Configured with: ../../../src/gcc-5.3.0/configure --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --prefix=/mingw64 --with-sysroot=/c/mingw530/x86_64-530-posix-seh-rt_v4-rev0/mingw64 --with-gxx-include-dir=/mingw64/x86_64-w64-mingw32/include/c++ --enable-shared --enable-static --disable-multilib --enable-languages=c,c++,fortran,lto --enable-libstdcxx-time=yes --enable-threads=posix --enable-libgomp --enable-libatomic --enable-lto --enable-graphite --enable-checking=release --enable-fully-dynamic-string --enable-version-specific-runtime-libs --disable-isl-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --enable-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=nocona --with-tune=core2 --with-libiconv --with-system-zlib --with-gmp=/c/mingw530/prerequisites/x86_64-w64-mingw32-static --with-mpfr=/c/mingw530/prerequisites/x86_64-w64-mingw32-static --with-mpc=/c/mingw530/prerequisites/x86_64-w64-mingw32-static --with-isl=/c/mingw530/prerequisites/x86_64-w64-mingw32-static --with-pkgversion='x86_64-posix-seh-rev0, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.net/projects/mingw-w64 CFLAGS='-O2 -pipe -I/c/mingw530/x86_64-530-posix-seh-rt_v4-rev0/mingw64/opt/include -I/c/mingw530/prerequisites/x86_64-zlib-static/include -I/c/mingw530/prerequisites/x86_64-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/c/mingw530/x86_64-530-posix-seh-rt_v4-rev0/mingw64/opt/include -I/c/mingw530/prerequisites/x86_64-zlib-static/include -I/c/mingw530/prerequisites/x86_64-w64-mingw32-static/include' CPPFLAGS= LDFLAGS='-pipe -L/c/mingw530/x86_64-530-posix-seh-rt_v4-rev0/mingw64/opt/lib -L/c/mingw530/prerequisites/x86_64-zlib-static/lib -L/c/mingw530/prerequisites/x86_64-w64-mingw32-static/lib '
    Thread model: posix
    gcc version 5.3.0 (x86_64-posix-seh-rev0, Built by MinGW-W64 project)
    

    On built with LiteIDE

    go build github.com/go-gl/glfw/v3.2/glfw: c:\go\pkg\tool\windows_amd64\cgo.exe: exit status 2
    go build github.com/go-gl/gl/v3.2-core/gl: c:\go\pkg\tool\windows_amd64\cgo.exe: exit status 2
    go build github.com/golang-ui/nuklear/nk: c:\go\pkg\tool\windows_amd64\cgo.exe: exit status 2
    Fehler: Prozess beendet mit Rückgabewert 1.
    

    On c:\go\pkg\tool\windows_amd64\cgo.exe: is nothing this cgo.exe

    Whats the problem?

  • SDL2 panic: vert_shdr failed to compile

    SDL2 panic: vert_shdr failed to compile

    @strangebroadcasts we have a problem

    macOS Sierra 10.12.1 go version go1.8 darwin/amd64

    $ nk-example-sdl2
    
    2017/03/28 13:38:58 SDL2: created window 400x500
    panic: vert_shdr failed to compile
    
    goroutine 1 [running, locked to thread]:
    github.com/golang-ui/nuklear/nk.deviceCreate()
    	/Users/xlab/Documents/dev/go/src/github.com/golang-ui/nuklear/nk/impl_sdl2_gl3.go:150 +0x580
    github.com/golang-ui/nuklear/nk.NkPlatformInit(0x461e8f0, 0x47d20c0, 0x1, 0x2)
    	/Users/xlab/Documents/dev/go/src/github.com/golang-ui/nuklear/nk/impl_sdl2_common.go:45 +0x91
    main.main()
    	/Users/xlab/Documents/dev/go/src/github.com/golang-ui/nuklear/cmd/nk-example-sdl2/main.go:49 +0x3e6
    
  • Crash with

    Crash with "fatal error: cgoUse should not be called" when using NkEditStringZeroTerminated

    Full test case here: https://gist.github.com/wolfgang42/07e8a2677c7f6e36393bdca862bebac2

    From reading runtime/cgo.go it looks like somehow the nuklear bindings have gotten into some kind of can't happen state, but I don't know enough about how any of this works to be able to figure out how this could happen.

  • SDL2 build failure

    SDL2 build failure

    Environment: $ env | grep GO111MODULE

    GO111MODULE=on
    

    $ go version

    go version go1.13.6 linux/amd64
    

    $ git log --pretty=oneline | head -n1

    f0bd027f267b002b45310df19d1b1191932cf884 Update nuklear to 4.01.0 and add clipboard support for GLFW_GL3. (#81)
    

    $ git branch

    * master
    

    Build: $ cd cmd/nk-example-sdl2/ $ go build -tags sdl2 main.go

    go: finding github.com/xlab/closer latest
    go: finding github.com/go-gl/gl latest
    go: finding github.com/golang-ui/nuklear latest
    # command-line-arguments
    ./main.go:57:48: undefined: MustAsset
    ./main.go:111:37: undefined: flag
    ./main.go:114:37: undefined: flag
    ./main.go:131:19: cannot use nk.NkColorPicker(ctx, state.bgColor, nk.ColorFormatRGBA) (type nk.Colorf) as type nk.Color in assignment
    ./main.go:131:48: cannot use state.bgColor (type nk.Color) as type nk.Colorf in argument to nk.NkColorPicker
    
  • Unable to install

    Unable to install

    Hi.

    I'm unable to install this. I don't get anything but errors. I'm on Linux. Feel free to ask my about the output. I'm not sure what to send, as I've gotten so many different outputs when trying to install this.

  • Random crash on MacOS v10.15.2

    Random crash on MacOS v10.15.2

    I met a random crash on MacOS v10.15.2 with go version 1.13.5, with GLFW backend.

    The crash log is:

    fatal error: unexpected signal during runtime execution
    [signal SIGSEGV: segmentation violation code=0x1 addr=0xffffffffffffffff pc=0xffffffffffffffff]
    
    runtime stack:
    runtime.throw(0x41f709d, 0x2a)
    	/usr/local/Cellar/go/1.13.5/libexec/src/runtime/panic.go:774 +0x72
    runtime.sigpanic()
    	/usr/local/Cellar/go/1.13.5/libexec/src/runtime/signal_unix.go:378 +0x47c
    
    goroutine 1 [syscall, locked to thread]:
    runtime.cgocall(0x41398f0, 0xc0000cbc78, 0xc000000180)
    	/usr/local/Cellar/go/1.13.5/libexec/src/runtime/cgocall.go:128 +0x5b fp=0xc0000cbc48 sp=0xc0000cbc10 pc=0x40056bb
    github.com/golang-ui/nuklear/nk._Cfunc_nk_group_begin(0x986a600, 0xc00001a100, 0x41, 0x0)
    	_cgo_gotypes.go:4128 +0x4d fp=0xc0000cbc78 sp=0xc0000cbc48 pc=0x40e280d
    

    It will happen after few minutes run. I tried to found out why, but cgo cannot provide enough information about where exactly the crash is happened so I put it here if anyone could give me a hint.

  • EditMultiline doesn't work in GLFW_GL3.

    EditMultiline doesn't work in GLFW_GL3.

    OS: MacOS 10.14.6 GO: 1.13 Backend: GLFW3.2/GL3 Nuklear: 4.01.0

    Minimal code sample is

    name := nk.NewTextEdit()
    nk.NkTexteditInitDefault(name)
    
    nk.NkEditBuffer(ctx, nk.EditEditor, name, nk.NkFilterDefault)
    

    I cannot enter any character in edit if the flag is nk.EditEditor.

    If change the flag to nk.EditBox, infinite "Enter" key is triggered once the edit box is focused.

  • Suggested way to use NkEditString?

    Suggested way to use NkEditString?

    I noticed that #31 proposed two solutions to use it, but I'm wondering are they the suggested way to use NkEditString\NkEditBuffer\NkEditStringTerminated?

  • Sailfish OS

    Sailfish OS

    Hello,

    This is a newbie question as I am not very aware of the different graphical toolkits. Is there any chance to run a Golang nuklear application under Sailfish OS ? Go getting the package leads to an error (probably due to the fact that Sailfish runs Wayland but I am not sure).

    Regards.

  • Fix go_vet and golint issues

    Fix go_vet and golint issues

    I made a PR to add Nuklear in the awesome-go list.

    It seems that one required thing for this is to fix some issues in the go_vet and golint, as explained by a collaborator:

    The goreportcard-tool lists the result of a few common linters used for go projects. Vet for example reports suspicous constructs, whereas golint lists some formal issues.

    Most of those issues can be quickly fixed and in addition to improve code quality, figuring in the awesome-go list will improve Nuklear visibility.

Platform-native GUI library for Go.

ui: platform-native GUI library for Go This is a library that aims to provide simple GUI software development in Go. It is based on my libui, a simple

Jan 9, 2023
Common library for Go GUI apps on Windows
Common library for Go GUI apps on Windows

winc Common library for Go GUI apps on Windows. It is for Windows OS only. This makes library smaller than some other UI libraries for Go.

Dec 12, 2022
Windows GUI library for Go (Golang). Comes with a graphical UI designer.

Version 2 Please go to Version 2 of this library for the latest version. Windows GUI Library This is a pure Go library to create native Windows GUIs.

Jan 1, 2023
Cross-platform Go/Golang GUI library.

中文 | English GoVCL Cross-platform Golang GUI library, The core binding is liblcl, a common cross-platform GUI library created by Lazarus. GoVCL is a n

Dec 30, 2022
Cross platform GUI in Go based on Material Design
Cross platform GUI in Go based on Material Design

About Fyne is an easy to use UI toolkit and app API written in Go. It is designed to build applications that run on desktop and mobile devices with a

Jan 3, 2023
Go wrapper around the Iup GUI toolset

Iup Go Wrapper iup is a Go wrapper around the Iup GUI toolkit. The project was started on April 27, 2011. Fork https://github.com/grd/iup is a fork of

Nov 28, 2020
Go Wrapper for the wxWidgets GUI

This is the source code for wxGo a Go wrapper of the wxWidgets library. The actuall wxWidgets source code is not included and will need to be downloa

Nov 30, 2022
Build cross platform GUI apps with GO and HTML/JS/CSS (powered by Electron)

Thanks to go-astilectron build cross platform GUI apps with GO and HTML/JS/CSS. It is the official GO bindings of astilectron and is powered by Electr

Jan 9, 2023
Build cross platform GUI apps with GO and HTML/JS/CSS (powered by nwjs)
Build cross platform GUI apps with GO and HTML/JS/CSS (powered by nwjs)

gowd Build cross platform GUI apps with GO and HTML/JS/CSS (powered by nwjs) How to use this library: Download and install nwjs Install this library g

Dec 11, 2022
A Windows GUI toolkit for the Go Programming Language
A Windows GUI toolkit for the Go Programming Language

About Walk Walk is a "Windows Application Library Kit" for the Go Programming Language. Its primarily useful for Desktop GUI development, but there is

Dec 30, 2022
RobotGo, Go Native cross-platform GUI automation @vcaesar

Robotgo Golang Desktop Automation. Control the mouse, keyboard, bitmap, read the screen, Window Handle and global event listener. RobotGo supports Mac

Jan 7, 2023
Cross-platform GUI for go is never this easy and clean.
Cross-platform GUI for go is never this easy and clean.

gimu Strongly suggest NOT to use this project anymore, the auto-generated cgo wrapper of Nuklear has a random crash issue which is hard to fix (becaus

Jul 12, 2022
Windows GUI framework for Go.

gform is an easy to use Windows GUI toolkit for Go It provides two approaches to create UI. 1. Pure code. gform.Init() mainWindow := gform.NewForm(ni

Jan 1, 2023
Easy Go GUI wrapper for interactive manipulation of visual algorithms/backend code.
Easy Go GUI wrapper for interactive manipulation of visual algorithms/backend code.

RenderView ================ Install: go get github.com/TheGrum/renderview Needs either Shiny (limited functionality), Gio, go-gtk, or gotk3. The latt

Aug 4, 2022
Super minimal, rock-solid foundation for concurrent GUI in Go.
Super minimal, rock-solid foundation for concurrent GUI in Go.

faiface/gui Super minimal, rock-solid foundation for concurrent GUI in Go. Installation go get -u github.com/faiface/gui Currently uses GLFW under th

Dec 23, 2022
Cross platform rapid GUI framework for golang based on Dear ImGui.
Cross platform rapid GUI framework for golang based on Dear ImGui.

giu Cross platform rapid GUI framework for golang based on Dear ImGui and the great golang binding imgui-go. Any contribution (features, widgets, tuto

Dec 28, 2022
GUI toolkit for go
GUI toolkit for go

Mostly-immediate-mode GUI library for Go. Source port to go of an early version of nuklear. ⚠️ Subject to backwards incompatible changes. ⚠️ ⚠️ Featur

Jan 1, 2023
A list of Go GUI projects

(Please follow @Go100and1 for updates on this page, and all kinds of details and facts in Go). A list of Go GUI/graphics/image related projects native

Jan 3, 2023
Odile is a simple GUI for the croc utility by Schollz.
Odile is a simple GUI for the croc utility by Schollz.

Odile Odile is a simple GUI for the croc utility by Schollz. This program uses Fyne, a UI toolkit written in Go, as the graphical interface. Effort wa

Dec 17, 2022