Cross platform rapid GUI framework for golang based on Dear ImGui.

giu

Join the chat at https://gitter.im/AllenDang-giu/community Go Report Card Build Status Godoc Card

Cross platform rapid GUI framework for golang based on Dear ImGui and the great golang binding imgui-go.

Any contribution (features, widgets, tutorials, documents and etc...) is appreciated!

Supported Platforms

giu is built upon GLFW v3.3, so idealy giu could support all platforms that GLFW v3.3 supports.

  • Windows (only tested on Windows 10 x64)
  • MacOS (only tested on MacOS v10.15)
  • Linux (thanks remeh to test it)
  • Raspberry pi 3b (thanks sndvaps to test it)

Features

Compare to other Dear ImGui golang bindings, giu has following features:

  • Small executable file size (<3mb after upx compression for the example/helloworld demo).
  • Live-update during the resizing of OS window (implemented on GLFW 3.3 and OpenGL 3.2).
  • Redraw only when user event occurred. Costs only 0.5% CPU usage with 60FPS.
  • Declarative UI (see examples for more detail).
  • DPI awareness (auto scale font and UI to adapte high DPI monitor).
  • Drop in usage, no need to implement render and platform.
  • OS clipboard support.

Screenshot Screenshot1 Screenshot2

Hello world

package main

import (
	"fmt"

	g "github.com/AllenDang/giu"
)

func onClickMe() {
	fmt.Println("Hello world!")
}

func onImSoCute() {
	fmt.Println("Im sooooooo cute!!")
}

func loop() {
	g.SingleWindow("hello world").Layout(
		g.Label("Hello world from giu"),
		g.Line(
			g.Button("Click Me").OnClick(onClickMe),
			g.Button("I'm so cute").OnClick(onImSoCute),
		),
	)
}

func main() {
	wnd := g.NewMasterWindow("Hello world", 400, 200, g.MasterWindowFlagsNotResizable, nil)
	wnd.Run(loop)
}

Here is result.

Helloworld

Install

The backend of giu depends on OpenGL 3.3, make sure your environment supports it (so far as I known some Virual Machine like VirualBox doesn't support it).

MacOS

xcode-select --install
go get github.com/AllenDang/giu@master

Windows

  1. Install mingw download here. Thanks @alchem1ster!
  2. Add the binaries folder of mingw to the path (usually is \mingw64\bin).
  3. go get github.com/AllenDang/giu@master.

Linux

Need help here cause I don't have any linux experience.

Deploy

Build MacOS version on MacOS.

go build -ldflags "-s -w" .

Build Windows version on Windows.

go build -ldflags "-s -w -H=windowsgui -extldflags=-static" .

Build Windows version on MacOS.

  1. Install mingw-64.
brew install mingw-w64
  1. Prepare and embed application icon to executable and build.
cat > YourExeName.rc << EOL
id ICON "./res/app_win.ico"
GLFW_ICON ICON "./res/app_win.ico"
EOL

x86_64-w64-mingw32-windres YourExeName.rc -O coff -o YourExeName.syso
GOOS=windows GOARCH=amd64 CGO_ENABLED=1 CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ HOST=x86_64-w64-mingw32 go build -ldflags "-s -w -H=windowsgui -extldflags=-static" -p 4 -v -o YourExeName.exe

rm YourExeName.syso
rm YourExeName.rc

Document

Check Wiki

Contribution

All kinds of pull request (document, demo, screenshots, code, etc...) are more then welcome!

Projects using giu

PipeIt

PipeIt is a text transformation, conversion, cleansing and extraction tool.

PipeIt Demo

NVTool

NVTool is a video encoding tool based on NVEncC.

NVTool Screenshots

Comments
  • [bug] Kind a glitch of desktop background from widgets when the main window has a transparent color

    [bug] Kind a glitch of desktop background from widgets when the main window has a transparent color

    What happend?

    Hey there,

    i'm not 100% sure if this is a bug, but i want to create a main window with a slight transparent color. I did the following:

    • Created a new main window with the flag g.MasterWindowFlagsTransparent
    • Set the main window background color to something transparent like wnd.SetBgColor(color.RGBA{A: 175})
    • Create a window with some widgets
    • Then, the background behind the actual main window will kinda glitch through the created window (see following image as reference)

    grafik

    I'll added the code that i used to take the screenshot to reproduce/test.

    Any ideas to fix this issue?

    Kind regards

    Code example

    main.go
    package main
    
    import (
    	g "github.com/AllenDang/giu"
    	"image/color"
    )
    
    var (
    	foo  string
    	foo2 bool
    )
    
    func loop() {
    	//Render one window
    	g.Window("Test window").Layout(
    		g.Label("Hello World! I'm a label"),
    		g.Selectable("Hello World! I'm a selectable"),
    		g.InputText(&foo).Hint("You can enter something here..."),
    		g.Checkbox("Check me!", &foo2),
    		g.Button("Press me!"),
    		g.RadioButton("One lonely radio button!", foo2),
    
    		g.Table().Columns(
    			g.TableColumn("Col1"),
    			g.TableColumn("Col2"),
    			g.TableColumn("Col3"),
    		).Rows(
    			g.TableRow(
    				g.Label("Row1"),
    				g.Label("Row1"),
    				g.Label("Row1"),
    			),
    			g.TableRow(
    				g.Label("Row2"),
    				g.Label("Row2"),
    				g.Label("Row2"),
    			),
    			g.TableRow(
    				g.Label("Row3"),
    				g.Label("Row3"),
    				g.Label("Row3"),
    			),
    		).Size(400, 200),
    
    		g.Child().Layout(
    			g.Checkbox("Checkbox inside a child!", &foo2),
    			g.Checkbox("Checkbox inside a child!", &foo2),
    			g.Checkbox("Checkbox inside a child!", &foo2),
    			g.Checkbox("Checkbox inside a child!", &foo2),
    			g.Checkbox("Checkbox inside a child!", &foo2),
    			g.Checkbox("Checkbox inside a child!", &foo2),
    			g.Checkbox("Checkbox inside a child!", &foo2),
    		).Size(200, 100),
    	)
    
    	//Render another window
    	g.Window("I have no focus").Size(200, 100).Layout(
    		g.Checkbox("I'm a checkbox!", &foo2),
    	)
    }
    
    func main() {
    	//Main window (set flag transparent, otherwise transparent color will not work)
    	wnd := g.NewMasterWindow("Hello World!", 800, 600, g.MasterWindowFlagsTransparent)
    
    	//Set main window slightly transparent
    	wnd.SetBgColor(color.RGBA{A: 175})
    
    	wnd.Run(loop)
    }
    

    To Reproduce

    1. Run my demo
    2. You should see the same as my screenshot (if ur background is green :D)

    Version

    master (v0.6.2)

    OS

    Windows 11 Go 1.18

  • Unsafe pointer arithmetic

    Unsafe pointer arithmetic

    I've compiled application with -race and it crashed right before showing up GUI.

    fatal error: checkptr: unsafe pointer arithmetic
    
    goroutine 1 [running, locked to thread]:
    runtime.throw(0xce6324, 0x23)
            /usr/lib/go/src/runtime/panic.go:1112 +0x72 fp=0xc00011fa18 sp=0xc00011f9e8 pc=0x483d12
    runtime.checkptrArithmetic(0x1, 0x0, 0x0, 0x0)
            /usr/lib/go/src/runtime/checkptr.go:24 +0xce fp=0xc00011fa48 sp=0xc00011fa18 pc=0x456fde
    github.com/AllenDang/giu/imgui.TextureID.handle(...)
            /home/pztrn/projects/go/pkg/mod/github.com/!allen!dang/[email protected]/imgui/TextureID.go:24
    github.com/AllenDang/giu/imgui.FontAtlas.SetTextureID.func1(0x27280e0, 0x1)
            /home/pztrn/projects/go/pkg/mod/github.com/!allen!dang/[email protected]/imgui/FontAtlas.go:174 +0x78 fp=0xc00011fa88 sp=0xc00011fa48 pc=0xa3c3c8
    github.com/AllenDang/giu/imgui.FontAtlas.SetTextureID(0x27280e0, 0x1)
            /home/pztrn/projects/go/pkg/mod/github.com/!allen!dang/[email protected]/imgui/FontAtlas.go:174 +0x43 fp=0xc00011faa8 sp=0xc00011fa88 pc=0xa35683
    github.com/AllenDang/giu/imgui.(*OpenGL3).createFontsTexture(0xc000074230)
            /home/pztrn/projects/go/pkg/mod/github.com/!allen!dang/[email protected]/imgui/RendererOpenGL3.go:338 +0x3e5 fp=0xc00011fb50 sp=0xc00011faa8 pc=0xa289f5
    github.com/AllenDang/giu/imgui.(*OpenGL3).createDeviceObjects(0xc000074230)
            /home/pztrn/projects/go/pkg/mod/github.com/!allen!dang/[email protected]/imgui/RendererOpenGL3.go:292 +0xd26 fp=0xc00011fcc8 sp=0xc00011fb50 pc=0xa28256
    github.com/AllenDang/giu/imgui.NewOpenGL3(0x2724368, 0x3fe00000, 0xb, 0x258, 0x1f4)
            /home/pztrn/projects/go/pkg/mod/github.com/!allen!dang/[email protected]/imgui/RendererOpenGL3.go:46 +0x1f5 fp=0xc00011fd50 sp=0xc00011fcc8 pc=0xa25485
    github.com/AllenDang/giu.NewMasterWindowWithBgColor(0xcd52c1, 0xb, 0x258, 0x1f4, 0x1, 0xc00011fec0, 0x0, 0x7fd2ff3d8108)
            /home/pztrn/projects/go/pkg/mod/github.com/!allen!dang/[email protected]/MasterWindow.go:54 +0x263 fp=0xc00011fe30 sp=0xc00011fd50 pc=0xa53723
    github.com/AllenDang/giu.NewMasterWindow(...)
            /home/pztrn/projects/go/pkg/mod/github.com/!allen!dang/[email protected]/MasterWindow.go:25
    
  • how can I make custom widget occupying some width/height

    how can I make custom widget occupying some width/height

    I have viewed examples/customwidget.go. If I commented out two lines. It will see picture below.

    So it's g.InvisibleButton who make this custom widget moved the CursorPos.

    There is g.GetCursorPos() to get canvas cursor position. But we have no g.SetCursorPos() to set cursor position.

    My question is: if I create a chart, how can I make my widget occupying some width/height?

    	// Place a invisible button to be a placeholder for events
    	// buttonWidth := float32(radius) * 2
    	// g.InvisibleButton(c.id).Size(buttonWidth, buttonWidth).OnClick(c.clicked).Build()
    

    782BBCDE-5BD5-4F47-A95F-AE529BC0F343

    Thanks.

  • Static linking

    Static linking

    Was wondering if anyone ever did manage to compile a giu/imgui-go binary for linux with static-linking. You can see the message I sent to one of my friends (of course they had no clue) (I was using imgui-go at the time but the "problem" is the same with giu):

    trying to compile an imgui-go (https://github.com/inkyblackness/imgui-go/) project with static linking.
    the normal command, go build -x -o dist/ src/main.go works fine.
    
    imgui-go is go bindings for Dear ImGui, which of course needs to use CGO.
    it depends on GLFW, Xrandr & some other GL stuff.
    
    The following command is what I first tried to use:
    go build -tags osusergo,netgo,static -ldflags="-linkmode external" -x -o dist/ src/main.go
    
    it seems to work just fine on my machine, but when running it on another machine it just exits with "no such file or directory", so it seems that I am not properly doing the static linking, but how would I go on about doing that? 
    

    I can say that both the machines run Linux distributions (compile machine is Fedora/Alpine and the other test machine is Artix). They both have the same Go version (1.17.5) even though I know it has nothing to do with that dysfunction.

    This is more of an "ask for help" than an "issue" to be honest, I just don't know where else to ask.

  • fatal panic on starting giu

    fatal panic on starting giu

    Yo, I just noticed, that giu doesn't start on my machine anymore. When I'm running any example/code, it crashes with a following panic:

    widgets: imgui.cpp:7192: void ImGui::ErrorCheckNewFrameSanityChecks(): Assertion `g.IO.Fonts->Fonts[0]->IsLoaded() && "Font Atlas not built. Did you call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8()?"' failed.
    SIGABRT: abort
    PC=0x7f31fc71b9e5 m=0 sigcode=18446744073709551610
    signal arrived during cgo execution
    
    goroutine 1 [syscall, locked to thread]:
    runtime.cgocall(0x634e60, 0xc00011fda0, 0x4000)
    	/usr/local/go/src/runtime/cgocall.go:154 +0x5b fp=0xc00011fd70 sp=0xc00011fd38 pc=0x48673b
    github.com/AllenDang/imgui-go._Cfunc_iggNewFrame()
    	_cgo_gotypes.go:4742 +0x3c fp=0xc00011fda0 sp=0xc00011fd70 pc=0x57d1dc
    github.com/AllenDang/imgui-go.NewFrame(...)
    	/home/username/go/pkg/mod/github.com/!allen!dang/[email protected]/imgui.go:30
    github.com/AllenDang/giu.(*MasterWindow).render(0xc00031a000)
    	/run/media/username/SALATKA/mystuff/test/giu/MasterWindow.go:182 +0x9b fp=0xc00011fe10 sp=0xc00011fda0 pc=0x62505b
    github.com/AllenDang/giu.(*MasterWindow).run.func1()
    	/run/media/username/SALATKA/mystuff/test/giu/MasterWindow.go:201 +0x59 fp=0xc00011fe50 sp=0xc00011fe10 pc=0x629eb9
    github.com/faiface/mainthread.Call.func1()
    	/home/username/go/pkg/mod/github.com/faiface/[email protected]/mainthread.go:63 +0x2f fp=0xc00011fe80 sp=0xc00011fe50 pc=0x58b48f
    github.com/faiface/mainthread.Run(0xc0003184e0)
    	/home/username/go/pkg/mod/github.com/faiface/[email protected]/mainthread.go:44 +0xb1 fp=0xc00011ff08 sp=0xc00011fe80 pc=0x58b211
    github.com/AllenDang/giu.(*MasterWindow).Run(0xc00031a000, 0x8dcd58)
    	/run/media/username/SALATKA/mystuff/test/giu/MasterWindow.go:258 +0x65 fp=0xc00011ff28 sp=0xc00011ff08 pc=0x625305
    main.main()
    	/run/media/username/SALATKA/mystuff/test/giu/examples/widgets/widgets.go:211 +0x18f fp=0xc00011ff88 sp=0xc00011ff28 pc=0x63196f
    runtime.main()
    	/usr/local/go/src/runtime/proc.go:225 +0x256 fp=0xc00011ffe0 sp=0xc00011ff88 pc=0x4bb4f6
    runtime.goexit()
    	/usr/local/go/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc00011ffe8 sp=0xc00011ffe0 pc=0x4ed101
    
    goroutine 18 [chan receive]:
    github.com/faiface/mainthread.Call(0xc000240ba0)
    	/home/username/go/pkg/mod/github.com/faiface/[email protected]/mainthread.go:66 +0xc5
    github.com/AllenDang/giu.(*MasterWindow).run(0xc00031a000)
    	/run/media/username/SALATKA/mystuff/test/giu/MasterWindow.go:199 +0xa5
    github.com/AllenDang/giu.(*MasterWindow).Run.func1()
    	/run/media/username/SALATKA/mystuff/test/giu/MasterWindow.go:263 +0x4d
    github.com/faiface/mainthread.Run.func1(0xc0003184e0, 0xc000320000)
    	/home/username/go/pkg/mod/github.com/faiface/[email protected]/mainthread.go:37 +0x27
    created by github.com/faiface/mainthread.Run
    	/home/username/go/pkg/mod/github.com/faiface/[email protected]/mainthread.go:36 +0xa5
    
    rax    0x0
    rbx    0x7f31fc593740
    rcx    0x7f31fc71b9e5
    rdx    0x0
    rdi    0x2
    rsi    0x7ffd630b7c70
    rbp    0x7f31fc871680
    rsp    0x7ffd630b7c70
    r8     0x0
    r9     0x7ffd630b7c70
    r10    0x8
    r11    0x246
    r12    0x91a372
    r13    0x1c18
    r14    0x91e618
    r15    0xffffffffffffffff
    rip    0x7f31fc71b9e5
    rflags 0x246
    cs     0x33
    fs     0x0
    gs     0x0
    exit status 2
    

    I'm running examples/widgets.

    my system:

    • OS: Fedora 33
    • desktop: gnome-shell 3.38.4
  • examples/dynamicloadfont: example crashes

    examples/dynamicloadfont: example crashes

    Hi! I wanted to run examples/dynmiacloadfont but it panics:

    dynamicloadfont: imgui.cpp:7112: void ImGui::ErrorCheckNewFrameSanityChecks(): Assertion `g.IO.Fonts->Fonts[0]->IsLoaded() && "Font Atlas not built. Did you call io.Fonts->GetTexDataAsRGBA32() / GetTexDataAsAlpha8()?"' failed.
    SIGABRT: abort
    PC=0x7f43aff019d5 m=0 sigcode=18446744073709551610
    signal arrived during cgo execution
    
    goroutine 1 [syscall, locked to thread]:
    runtime.cgocall(0x6131f0, 0xc0000cddb8, 0x4000)
            /usr/local/go/src/runtime/cgocall.go:154 +0x5b fp=0xc0000cdd88 sp=0xc0000cdd50 pc=0x48567b
    github.com/AllenDang/imgui-go._Cfunc_iggNewFrame()
            _cgo_gotypes.go:4546 +0x3c fp=0xc0000cddb8 sp=0xc0000cdd88 pc=0x571d5c
    github.com/AllenDang/imgui-go.NewFrame(...)
            /home/user/go/pkg/mod/github.com/!allen!dang/[email protected]/imgui.go:28
    github.com/AllenDang/giu.(*MasterWindow).render(0xc000186000)
            /home/user/git/d2/me/giu/MasterWindow.go:174 +0x96 fp=0xc0000cde28 sp=0xc0000cddb8 pc=0x60faf6
    github.com/AllenDang/giu.(*MasterWindow).run.func1()
            /home/user/git/d2/me/giu/MasterWindow.go:193 +0x59 fp=0xc0000cde68 sp=0xc0000cde28 pc=0x610219
    github.com/faiface/mainthread.Call.func1()
            /home/user/go/pkg/mod/github.com/faiface/[email protected]/mainthread.go:63 +0x2f fp=0xc0000cde98 sp=0xc0000cde68 pc=0x57804f
    github.com/faiface/mainthread.Run(0xc00000e4c8)
            /home/user/go/pkg/mod/github.com/faiface/[email protected]/mainthread.go:44 +0xb1 fp=0xc0000cdf20 sp=0xc0000cde98 pc=0x577dd1
    github.com/AllenDang/giu.(*MasterWindow).Run(0xc000186000, 0x8aca58)
            /home/user/git/d2/me/giu/MasterWindow.go:250 +0x65 fp=0xc0000cdf40 sp=0xc0000cdf20 pc=0x60fda5
    main.main()
            /home/user/git/d2/me/giu/examples/dynmiacloadfont/dynamicloadfont.go:34 +0x73 fp=0xc0000cdf88 sp=0xc0000cdf40 pc=0x6108f3
    runtime.main()
            /usr/local/go/src/runtime/proc.go:225 +0x256 fp=0xc0000cdfe0 sp=0xc0000cdf88 pc=0x4ba0f6
    runtime.goexit()
            /usr/local/go/src/runtime/asm_amd64.s:1371 +0x1 fp=0xc0000cdfe8 sp=0xc0000cdfe0 pc=0x4ebb81
    
    goroutine 5 [chan receive]:
    github.com/faiface/mainthread.Call(0xc00009af60)
            /home/user/go/pkg/mod/github.com/faiface/[email protected]/mainthread.go:66 +0xc5
    github.com/AllenDang/giu.(*MasterWindow).run(0xc000186000)
            /home/user/git/d2/me/giu/MasterWindow.go:191 +0xa5
    github.com/AllenDang/giu.(*MasterWindow).Run.func1()
            /home/user/git/d2/me/giu/MasterWindow.go:255 +0x4d
    github.com/faiface/mainthread.Run.func1(0xc00000e4c8, 0xc000024120)
            /home/user/go/pkg/mod/github.com/faiface/[email protected]/mainthread.go:37 +0x27
    created by github.com/faiface/mainthread.Run
            /home/user/go/pkg/mod/github.com/faiface/[email protected]/mainthread.go:36 +0xa5
    
    rax    0x0
    rbx    0x7f43afd79740
    rcx    0x7f43aff019d5
    rdx    0x0
    rdi    0x2
    rsi    0x7fff653957b0
    rbp    0x7f43b0057680
    rsp    0x7fff653957b0
    r8     0x0
    r9     0x7fff653957b0
    r10    0x8
    r11    0x246
    r12    0x8e48b2
    r13    0x1bc8
    r14    0x8e8978
    r15    0xffffffffffffffff
    rip    0x7f43aff019d5
    rflags 0x246
    cs     0x33
    fs     0x0
    gs     0x0
    exit status 2
    
  • DPI scale - unexpected behavior

    DPI scale - unexpected behavior

    This commit https://github.com/AllenDang/giu/commit/27ecca73d762cacc8bdd23e12dd18c07b76623ab breaks UI rendering on high monitor resolution.

    Before:

    After:

  • test pull requests

    test pull requests

    @allenDang what about a github workflow, which will check if project is able to build? or you can add branch protection rule to master with Require test status from travisCI to prevent unbuildable PR to be merged.

    Originally posted by @gucio321 in https://github.com/AllenDang/giu/issues/314#issuecomment-912970533

  • Remove imgui-go, implot, imnodes, ImGuiColorTextEdit from repo

    Remove imgui-go, implot, imnodes, ImGuiColorTextEdit from repo

    @AllenDang what are your thoughts on merging these changes upstream?

    I removed all of the hard copies of the dependencies in favor of importing them via a fork of imgui-go: https://github.com/ianling/imgui-go -- this fork is up-to-date with the upstream imgui-go repo as of yesterday, and also has all of the changes you've made in the giu repo.

    If you are interested in changing to this style, we could merge this PR and I can transfer the fork ianling/imgui-go to your account. All instances of ianling would also need to be changed back to AllenDang

    I think the main benefits of making this change are:

    • reduces clutter by having a clear separation between the low-level CGo wrappers in imgui-go/implot/imnodes/ImGuiColorTextEdit and the clean high-level API provided by giu
    • easier to maintain. If you need to make custom changes to imgui-go (or one of the other C++ libraries), you simply commit the change in the fork and import the new commit in giu. If the official imgui-go repo releases an update, or ImGui itself receives an update, it is very simple to update this fork.
      • you can also update the imgui-go fork separately from giu, and continue building giu from the previous commit if there are breaking changes and you don't have time to update both repos at once.
  • [Windows] go get github.com/AllenDang/giu fails

    [Windows] go get github.com/AllenDang/giu fails

    Not sure what the requirements are, just following along with the README.

    Error:

    # github.com/AllenDang/giu/imgui
    C:\Users\#####\AppData\Local\Temp\go-build3633627171\b001\_x039.o: In function `ImeSetInputScreenPosFn_DefaultImpl':
    ..\..\..\go\pkg\mod\github.com\!allen!dang\[email protected]\imgui/imgui.cpp:10724: undefined reference to `ImmGetContext'
    ..\..\..\go\pkg\mod\github.com\!allen!dang\[email protected]\imgui/imgui.cpp:10730: undefined reference to `ImmSetCompositionWindow'
    ..\..\..\go\pkg\mod\github.com\!allen!dang\[email protected]\imgui/imgui.cpp:10731: undefined reference to `ImmReleaseContext'
    collect2.exe: error: ld returned 1 exit status
    
  • Race condition between texture creation and deletion (via finalizer)

    Race condition between texture creation and deletion (via finalizer)

    Texture creation can randomly fail if another texture happens to be finalizing in the background.

    This is causing deadlocks in our project.

    ~~The deadlock is happening between Texture.release and NewTextureFromRgba.~~ read below

  • How to disable AntiAliasedLines with giu/golang

    How to disable AntiAliasedLines with giu/golang

    What happend?

    in imgui_demo.cpp in line 6208 I can find: ImGui::Checkbox("Anti-aliased lines", &style.AntiAliasedLines); to enable/disable AntiAliasedLines.

    Can't find a wrapper for this.

    How this can be done with giu/golang ? How to read/write the style structure?

    Code example

    To Reproduce

    Version

    master

    OS

    linux

  • [bug] empty table issue

    [bug] empty table issue

    What happend?

    I created a table without rows, but table didn't show. I found a special if condition in the beginning of TableWidgets's Build function:

    // Build implements Widget interface.
    func (t *TableWidget) Build() {
    	if len(t.rows) == 0 {
    		return
    	}
    ...
    

    It seems tables stop rendering when no rows? It's a mistake or by design?

    Code example

    main.go
    package main
    
    import (
    	g "github.com/AllenDang/giu"
    )
    
    func main() {
    	wnd := g.NewMasterWindow("emptytable", 400, 200, 0)
    	wnd.Run(func() {
    		g.SingleWindow().Layout(
    			g.Table().Size(200, 200).Columns(
    				g.TableColumn("Col1"),
    				g.TableColumn("Col2"),
    				g.TableColumn("Col3"),
    			).Rows(
    				//g.TableRow(g.Label("Val1"), g.Label("Val2"), g.Label("Val3")),
    			),
    		)
    	})
    }
    

    To Reproduce

    1. Run my demo
    2. Table doesn't show
    3. Uncomment row definition code, table shows normally

    Version

    (latest)

    OS

    windows 10

  • [bug]g.Context.FontAtlas.SetDefaultFontSize can't invoke before g.NewMasterWindow

    [bug]g.Context.FontAtlas.SetDefaultFontSize can't invoke before g.NewMasterWindow

    What happend?

    g.Context is nil

    panic: runtime error: invalid memory address or nil pointer dereference

    Code example

    main.go

    package main

    import ( g "github.com/AllenDang/giu" )

    func loop() { g.SingleWindow().Layout( g.Style().To( g.Label("test"), ), ) } func main() { g.Context.FontAtlas.SetDefaultFontSize(12) wnd := g.NewMasterWindow("test", 1024, 768, g.MasterWindowFlagsMaximized) wnd.Run(loop) }

    To Reproduce

    1. Run my demo
    2. will see the crash...

    Version

    master

    OS

    windows

  • cimgui-go Migration

    cimgui-go Migration

    Hi there! Here is my proposal of a simple way to migrate from imgui-go to cimgui-go. I'm using regular expressions within a simple shell script. As I finish this, I'll try to keep it up to data and uptade to the latest cimgui-go (when available)

    NOTE - this .sh script is really primitive - it is just a set of sed calls on various files in the project.

    progress

    the list above shows, which files (after running migrate.sh) does not have any build errors:

    • [x] Alignment.go
    • [x] build_windows.go
    • [x] Canvas.go
    • [ ] ClickableWidgets.go (NOTE: need to fix ImageButton)
    • [ ] cmd
    • [ ] CodeEditor.go (disabled)
    • [ ] Context.go
    • [ ] Context_test.go
    • [ ] CSS.go
    • [x] Direction.go
    • [x] doc.go
    • [x] EventHandler.go
    • [ ] Events.go (fix Keycode first)
    • [ ] examples
    • [x] ExtraWidgets.go
    • [x] Flags.go (NOTE fix ColorEditFlags)
    • [ ] FontAtlasProsessor.go (platform and renderer dependency; cannot resolve some reference)
    • [ ] ImageWidgets.go (platform dependency - probably will fix manually)
    • [ ] InputHandler.go
    • [ ] InputHandler_test.go
    • [ ] Keycode.go
    • [x] Layout.go
    • [x] Layout_test.go
    • [x] ListClipper.go
    • [ ] Markdown.go (disabled)
    • [ ] MasterWindow.go
    • [ ] MemoryEditor.go (disabled)
    • [x] Msgbox.go
    • [ ] Plot.go
    • [x] Popups.go
    • [x] ProgressIndicator.go
    • [x] SliderWidgets.go
    • [x] SplitLayout.go
    • [x] StackWidget.go
    • [x] Style.go
    • [x] StyleIDs.go
    • [x] StyleIDs_string2enum.go
    • [ ] StyleIDs_string.go
    • [ ] StyleSetter.go
    • [ ] TableWidgets.go
    • [ ] TextureFilters.go (I'm not actually sure what these constants reffers to - no typed)
    • [ ] Texture.go (it's not really clear to me but I suppose giu wraps a wrong type atm - cimgui.ImGuiTextureID vs cimgui.Texture)
    • [ ] TextWidgets.go
    • [ ] Utils.go
    • [ ] Utils_test.go
    • [ ] Widgets.go (problemm with ColorEditWidget - api has changed a bit; also see TODOs in migration.sh)
    • [ ] Window.go (problem with platform stuff)

    * files tagged with (disabled) are commented-out because they are not supported by cimgui-go

    further steps

    as it is only intended to "procedurally migrate" current code into cimgui, I've decided not to take the following actions:

    • this PR will not actually change any code - it just adds migration script and list of api changes (in migration.txt)
    • change any files manually - issues like that in MasterWIndow.go needs to be fixed manually later
Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies
Dear ImGui: Bloat-free Graphical User interface for C++ with minimal dependencies

Dear ImGui (This library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addit

Dec 31, 2022
Cross-Platform GUI Framework for Go

⚠️ I'm currently working on this project as part of my master's thesis at the Berlin University of Applied Sciences and Technology. It is under active

Oct 31, 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
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
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
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
Kita is a declarative, reactive GUI toolkit for build cross platform apps with web technology with single codebase
Kita is a declarative, reactive GUI toolkit for build cross platform apps with web technology with single codebase

Kita is a declarative, reactive GUI toolkit for build cross platform apps with web technology with single codebase. Inspired by Flutter, React. S

Apr 18, 2022
UIKit - A declarative, reactive GUI toolkit for build cross platform apps with web technology with single codebase
 UIKit - A declarative, reactive GUI toolkit for build cross platform apps with web technology with single codebase

UIKit - A declarative, reactive GUI toolkit for build cross platform apps with web technology with single codebase

Apr 18, 2022
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
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
Tiny cross-platform webview library for C/C++/Golang. Uses WebKit (Gtk/Cocoa) and Edge (Windows)

webview A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs. Also, there are Rust bindings, Python bindings, Ni

Dec 28, 2022
Tiny cross-platform webview library for C/C++/Golang. Uses WebKit (Gtk/Cocoa) and Edge (Windows)

webview A tiny cross-platform webview library for C/C++/Golang to build modern cross-platform GUIs. Also, there are Rust bindings, Python bindings, Ni

Jan 1, 2023
An experimental Go cross platform UI library.

GXUI - A Go cross platform UI library. Notice: Unfortunately due to a shortage of hours in a day, GXUI is no longer maintained. If you're looking for

Jan 6, 2023
Build cross-platform modern desktop apps in Go + HTML5
Build cross-platform modern desktop apps in Go + HTML5

Lorca A very small library to build modern HTML5 desktop apps in Go. It uses Chrome browser as a UI layer. Unlike Electron it doesn't bundle Chrome in

Jan 6, 2023
Cross-platform Go library to place an icon in the host operating system's taskbar.

trayhost Package trayhost is a cross-platform Go library to place an icon in the host operating system's taskbar. Platform Support macOS - Fully imple

Nov 6, 2022
Go cross-platform library for displaying dialogs and input boxes

dlgs dlgs is a cross-platform library for displaying dialogs and input boxes. Installation go get -u github.com/gen2brain/dlgs Documentation Document

Dec 24, 2022
A cross-platform app-development module for Go.
A cross-platform app-development module for Go.

The cross-platform Go module for building apps (pronounced klo-va-seed). Usecases As a lightweight alternative to Electron Write your frontend and nat

Dec 1, 2022