-
Notifications
You must be signed in to change notification settings - Fork 1
Installation
- Go 1.26 or later
- SDL2 development libraries — go-gui uses SDL2 for windowing, input, and audio. The specific packages required depend on your OS.
Install dependencies via Homebrew:
brew install go pkg-config sdl2 sdl2_mixer freetype harfbuzz pango fontconfigsudo apt-get update
sudo apt-get install -y \
golang build-essential pkg-config \
libsdl2-dev libsdl2-mixer-dev libfreetype6-dev libharfbuzz-dev \
libpango1.0-dev libfontconfig1-devsudo dnf install -y golang gcc pkgconf-pkg-config \
SDL2-devel SDL2_mixer-devel freetype-devel harfbuzz-devel pango-devel fontconfig-develsudo pacman -Syu --noconfirm go base-devel pkgconf \
sdl2 sdl2_mixer freetype2 harfbuzz pango fontconfigInstall MSYS2, then from the MSYS2 MinGW x64 shell:
pacman -S --needed \
mingw-w64-x86_64-go mingw-w64-x86_64-gcc \
mingw-w64-x86_64-pkgconf mingw-w64-x86_64-SDL2 \
mingw-w64-x86_64-SDL2_mixer mingw-w64-x86_64-freetype \
mingw-w64-x86_64-harfbuzz mingw-w64-x86_64-pango \
mingw-w64-x86_64-fontconfigUse the MSYS2 MinGW x64 shell for go build and go run.
vcpkg install sdl2:x64-windows sdl2-mixer:x64-windows \
freetype:x64-windows harfbuzz:x64-windows pango:x64-windows \
fontconfig:x64-windowsSet CGO_CFLAGS and CGO_LDFLAGS to the vcpkg include and lib paths before building.
go get github.com/mike-ward/go-guiRun the minimal example to confirm SDL2 is wired up correctly:
go run github.com/mike-ward/go-gui/examples/get_started@latestOr, after cloning the repository:
go run ./examples/get_started/A small window with a click counter should appear. If you see it, everything is working.
For a full tour of the widget library, run the showcase:
go run ./examples/showcase/backend.Run(w) automatically selects Metal on macOS and OpenGL on Linux/Windows. To target
a specific backend explicitly:
import "github.com/mike-ward/go-gui/gui/backend/metal" // macOS, Metal
import "github.com/mike-ward/go-gui/gui/backend/gl" // cross-platform, OpenGL
import "github.com/mike-ward/go-gui/gui/backend/web" // WASM / browser
import "github.com/mike-ward/go-gui/gui/backend/ios" // iOS, Metal + UIKitFor headless testing (CI, unit tests) the gui/backend/test no-op backend runs all layout and
widget logic without a display server.
Getting Started
Widgets
Layout & Interaction
Visuals
Reference