wio is a platform abstraction library, providing:
- window management and events
- clipboard access
- alert dialogs
- joystick input
- audio
- software framebuffer
- OpenGL context creation
- Vulkan WSI
The public API can be browsed in src/wio.zig.
The demo directory contains a test program which covers most functionality and uses OpenGL.
The examples directory contains small programs using other rendering APIs.
By default, only a subset of the API is available. The following build options enable additional features:
enable_framebufferenable_openglenable_vulkanenable_audioenable_joystick
Actively tested:
- Windows
- macOS (10.13+)
- Linux
- Android
- WebAssembly
Not actively tested, but most code is shared with Linux:
- OpenBSD
- NetBSD
- FreeBSD
- DragonFlyBSD
- illumos
Not actively tested:
- Haiku
The framebuffer API is not currently implemented for Haiku.
The joystick API is not currently implemented for Android, OpenBSD, NetBSD, FreeBSD, DragonFlyBSD, or illumos.
The audio API is not currently implemented for Android, WebAssembly, NetBSD, FreeBSD, DragonFlyBSD, or illumos.
wio embeds an application manifest by default. To use a custom manifest,
set the win32_manifest build option to false.
If audio is enabled, wio initializes COM with options COINIT_MULTITHREADED
and COINIT_DISABLE_OLE1DDE.
An application bundle is provided in demo/wio.app, which can be adapted
by changing the CFBundleExecutable and CFBundleName values in Info.plist.
Message boxes are implementing by spawning kdialog or zenity.
Unix-like systems support different backends in the same executable. By default
all backends are enabled, the unix_backends build option can be used to
limit the choices.
When building a project that uses wio, passing -fsys=wio to zig build will
link libraries explicitly (rather than using dlopen).
To assist with packaging your project, it is recommended to expose
unix_backends in your build script and document -fsys=wio.
The following libraries are loaded for the X11 backend:
libX11.so.6libXcursor.so.1libGL.so.1(if OpenGL is enabled)
The following libraries are loaded for the Wayland backend:
libwayland-client.so.0libxkbcommon.so.0libdecor-0.so.0libwayland-egl.so.1(if OpenGL is enabled)libEGL.so.1(if OpenGL is enabled)
The following libraries are loaded under Linux:
libudev.so.1(if joysticks are enabled)libpulse.so.0(if audio is enabled)
If OpenGL is enabled, wio imports createContext and makeContextCurrent
from the gl module. WebGL 1 bindings are provided in demo/wasm.js.
glGetProcAddress always returns null.
The following variables and fields may be considered part of the public API for a given platform:
Window.backend.windowis the Win32HWND
Window.backend.windowis the AppKitNSWindow
wio.backend.active is an enum variable specifying the backend in use:
wio.backend.x11.displayis the Xlib displayWindow.backend.x11.windowis the Xlib window
wio.backend.wayland.displayis the Waylandwl_displayWindow.backend.wayland.surfaceis the Waylandwl_surface
Window.backend.idis the index into the JavaScript window array