{"id":18830982,"url":"https://github.com/allendang/giu","last_synced_at":"2025-05-13T20:09:22.362Z","repository":{"id":37027448,"uuid":"231019989","full_name":"AllenDang/giu","owner":"AllenDang","description":"Cross platform rapid GUI framework for golang based on Dear ImGui.","archived":false,"fork":false,"pushed_at":"2025-05-06T14:22:08.000Z","size":9640,"stargazers_count":2539,"open_issues_count":39,"forks_count":148,"subscribers_count":34,"default_branch":"master","last_synced_at":"2025-05-06T15:44:25.769Z","etag":null,"topics":["cross-platform","dear-imgui","golang","gui","imgui","ui","uikit"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AllenDang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"patreon":"AllenDang"}},"created_at":"2019-12-31T03:36:05.000Z","updated_at":"2025-05-06T14:22:04.000Z","dependencies_parsed_at":"2023-11-14T08:32:30.649Z","dependency_job_id":"f1fcdcab-cfe8-459e-a857-c01dde6aca87","html_url":"https://github.com/AllenDang/giu","commit_stats":{"total_commits":1192,"total_committers":43,"mean_commits":27.72093023255814,"dds":0.6191275167785235,"last_synced_commit":"2364349bcf4356b2216b5c3cc0b814fa302ae08d"},"previous_names":[],"tags_count":23,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AllenDang%2Fgiu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AllenDang%2Fgiu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AllenDang%2Fgiu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AllenDang%2Fgiu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AllenDang","download_url":"https://codeload.github.com/AllenDang/giu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254020605,"owners_count":22000752,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cross-platform","dear-imgui","golang","gui","imgui","ui","uikit"],"created_at":"2024-11-08T01:51:29.871Z","updated_at":"2025-05-13T20:09:22.344Z","avatar_url":"https://github.com/AllenDang.png","language":"Go","funding_links":["https://patreon.com/AllenDang"],"categories":[],"sub_categories":[],"readme":"# giu\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/AllenDang/giu)](https://goreportcard.com/report/github.com/AllenDang/giu)\n![Build Status](https://github.com/AllenDang/giu/actions/workflows/build.yml/badge.svg)\n[![Go Reference](https://pkg.go.dev/badge/github.com/AllenDang/giu.svg)](https://pkg.go.dev/github.com/AllenDang/giu)\n[![Discord Shield](https://discord.com/api/guilds/1306199225616306248/widget.png?style=shield)](https://discord.gg/Tt7eq6YKQS)\n\nA rapid cross-platform GUI framework for Go based on [Dear ImGui](https://github.com/ocornut/imgui) and the great Go binding [cimgui-go](https://github.com/inkyblackness/cimgui-go).\n\nAny contribution (features, widgets, tutorials, documents, etc...) is appreciated!\n\n## Sponsor\n\n(This library is available under a free and permissive license, but needs financial support to sustain its continued improvements. In addition to maintenance and stability there are many desirable features yet to be added. If you are using giu, please consider reaching out.)\n\nBusinesses: support continued development and maintenance via invoiced technical support, maintenance, sponsoring contracts:\n\nE-mail: \u003callengnr@gmail.com\u003e\n\nIndividuals: support continued development and maintenance [here](https://patreon.com/AllenDang).\n\n## Documentation\n\nFor documentation refer to [our wiki](https://github.com/AllenDang/giu/wiki),\n[examples](./examples), [GoDoc](https://pkg.go.dev/github.com/AllenDang/giu),\nor just take a look at comments in code.\n\n## Supported Platforms\n\ngiu is built upon GLFW v3.3, so ideally giu could support all platforms that GLFW v3.3 supports.\nIt is also restricted by cimgui-go (which at the moment builds only for linux, windows and mac).\n\n- Windows (Windows 10 x64 and Windows 11 x64)\n- macOS (macOS v10.15 and macOS Big Sur)\n- Linux (thanks remeh for testing it)\n- Raspberry Pi 3B (thanks sndvaps for testing it)\n\n\u003e [!note]\n\u003e Because giu relays on C++ code, you need to have C/C++ compiler set up.\n\n## Features\n\nCompared to other Dear ImGui golang bindings, giu has the following features:\n\n- Small executable file size (\u003c3MB after UPX compression for the example/helloworld demo).\n- Live-updating during the resizing of the OS window (implemented on GLFW 3.3 and OpenGL 3.2).\n- Support for displaying various languages without any font setting. Giu will rebuild font atlas incrementally according to texts in UI between frames.\n- Redraws only when user event occurs. Costs only 0.5% CPU usage with 60FPS.\n- Declarative UI (see examples for more details).\n- DPI awareness (auto scaling font and UI to adapt to high DPI monitors).\n- Drop in usage; no need to implement render and platform.\n- OS clipboard support.\n\n\u003ctable border=0\u003e\n\u003ctr\u003e\u003ctd\u003e\n\n![Screenshot](https://github.com/AllenDang/giu/raw/master/examples/imguidemo/screenshot.png)\n\n\u003ctd\u003e\n\n![Screenshot1](https://github.com/AllenDang/giu/blob/master/screenshots/SqlPower.png)\n\n\u003ctd\u003e\n\n![Screenshot2](https://github.com/AllenDang/giu/blob/master/screenshots/Chart.png)\n\n\u003c/table\u003e\n\n## Hello world\n\n```go\npackage main\n\nimport (\n        \"fmt\"\n\n        g \"github.com/AllenDang/giu\"\n)\n\nfunc onClickMe() {\n        fmt.Println(\"Hello world!\")\n}\n\nfunc onImSoCute() {\n        fmt.Println(\"Im sooooooo cute!!\")\n}\n\nfunc loop() {\n        g.SingleWindow().Layout(\n                g.Label(\"Hello world from giu\"),\n                g.Row(\n                        g.Button(\"Click Me\").OnClick(onClickMe),\n                        g.Button(\"I'm so cute\").OnClick(onImSoCute),\n                ),\n        )\n}\n\nfunc main() {\n        wnd := g.NewMasterWindow(\"Hello world\", 400, 200, g.MasterWindowFlagsNotResizable)\n        wnd.Run(loop)\n}\n```\n\nHere is the result:\n\n![Helloworld](https://github.com/AllenDang/giu/raw/master/examples/helloworld/helloworld.png)\n\n\u003cdetails\u003e\u003csummary\u003e\u003ch2\u003eQuick introduction\u003c/h2\u003e\u003c/summary\u003e\n\n### What is immediate mode GUI?\n\nImmediate mode GUI system means the UI control doesn't retain its state and value. For example, calling `giu.InputText(\u0026str)` will display a input text box on screen, and the user entered value will be stored in `\u0026str`. Input text box doesn't know anything about it.\n\nAnd the `loop` method in the _Hello world_ example is in charge of **drawing** all widgets based on the parameters passed into them. This method will be invoked 30 times per second to reflect interactive states (like clicked, hovered, value-changed, etc.). It will be the place you define the UI structure.\n\n### The layout and sizing system\n\nBy default, any widget placed inside a container's `Layout` will be placed vertically.\n\nTo create a row of widgets (i.e. place widgets one by one horizontally), use the `Row()` method. For example `giu.Row(Label(...), Button(...))` will create a Label next to a Button.\n\nTo create a column of widgets (i.e. place widgets one by one vertically) inside a row, use the `Column()` method.\n\nAny widget that has a `Size()` method, can set its size explicitly. Note that you can pass a negative value to `Size()`, which will fill the remaining width/height value. For example, `InputText(...).Size(giu.Auto)` will create an input text box with the longest width that its container has left.\n\n### Containers\n\n#### MasterWindow\n\nA `MasterWindow` means the platform native window implemented by the OS. All subwindows and widgets will be placed inside it.\n\n#### Window\n\nA `Window` is a container with a title bar, and can be collapsed. `SingleWindow` is a special kind of window that will occupy all the available space of `MasterWindow`.\n\n#### Child\n\nA `Child` is like a panel in other GUI frameworks - it can have a background color and border.\n\n### Widgets\n\nCheck `examples/widgets` for all kinds of widgets.\n\n\u003c/details\u003e\n\n## Install\n\nThe backend of giu depends on OpenGL 3.3, make sure your environment supports it (as far as I know, some Virtual Machines like VirtualBox doesn't support it).\n\n### MacOS\n\n```sh\nxcode-select --install\ngo get github.com/AllenDang/giu\n```\n\n### Windows\n\n1. Install mingw [download here](https://github.com/brechtsanders/winlibs_mingw/releases/latest). Thanks @alchem1ster!\n2. Add the binaries folder of mingw to the path (usually is _\\mingw64\\bin_).\n3. `go get github.com/AllenDang/giu` in your project\n\n### Linux\n\nFirst you need to install the required dependencies:\n\n\u003ctable\u003e\n\n\u003ctr\u003e\n\u003ctd\u003e\nDebian/Ubuntu\n\u003ctd\u003e\n\n```bash\nsudo apt install libx11-dev libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev libglx-dev libgl1-mesa-dev libxxf86vm-dev\n```\n\n\u003ctr\u003e\n\u003ctd\u003e\nFedora/Red Hat/CentOS\n\u003ctd\u003e\n\n```bash\nsudo dnf install libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel libXi-devel libGL-devel libXxf86vm-devel\n```\n\n\u003ctr\u003e\n\u003ctd\u003e\nArch Linux\n\u003ctd\u003e\n\n```bash\nsudo pacman -Sy glfw\n```\n\n\u003c/table\u003e\n\nyou may also need to install C/C++ compiler (like g++) if it isn't already installed. Follow go compiler prompts.\n\nThen, a simple `go build` will work.\n\nCross-compiling is a bit more complicated. Let's say that you want to build for arm64. This is what you would need to do:\n\n```bash\nsudo dpkg --add-architecture arm64\nsudo apt update\nsudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \\\n    libx11-dev:arm64 libxcursor-dev:arm64 libxrandr-dev:arm64 libxinerama-dev:arm64 libxi-dev:arm64 libglx-dev:arm64 libgl1-mesa-dev:arm64 libxxf86vm-dev:arm64\nGOOS=linux GOARCH=arm64 CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ HOST=aarch64-linux-gnu go build -v\n```\n\n## Deploying\n\n### MacOS -\u003e MacOS\n\n```sh\ngo build -ldflags \"-s -w\" .\n```\n\n### Windows -\u003e Windows\n\n```sh\ngo build -ldflags \"-s -w -H=windowsgui -extldflags=-static\" .\n```\n\n### MacOS/Linux -\u003e Windows\n\n#### Install mingw-64.\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd\u003e\nMac\n\u003ctd\u003e\n\n```sh\nbrew install mingw-w64\n```\n\n\u003ctr\u003e\u003ctd\u003e\nFedora/RHEL/CentOS\n\u003ctd\u003e\n\n```sh\nsudo dnf install mingw64-gcc mingw64-gcc-c++ mingw64-winpthreads-static\n```\n\n\u003ctr\u003e\n\u003ctd\u003e\nArch Linux\n\n\u003ctd\u003e\n\n```bash\npacman -Sy mingw-w64-gcc\n```\n\n\u003c/table\u003e\n\n2. Prepare and embed the application icon into the executable and build.\n\n```sh\ncat \u003e YourExeName.rc \u003c\u003c EOL\nid ICON \"./res/app_win.ico\"\nGLFW_ICON ICON \"./res/app_win.ico\"\nEOL\n\nx86_64-w64-mingw32-windres YourExeName.rc -O coff -o YourExeName.syso\nGOOS=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\n\nrm YourExeName.syso\nrm YourExeName.rc\n```\n\n## Contribution\n\nAll kinds of pull requests (document, demo, screenshots, code, etc.) are more than welcome!\n\n## Star History\n\n[![Star History Chart](https://api.star-history.com/svg?repos=AllenDang/giu\u0026type=Date)](https://star-history.com/#AllenDang/giu\u0026Date)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallendang%2Fgiu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallendang%2Fgiu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallendang%2Fgiu/lists"}