Ziggified GLFW bindings with 100% API coverage, zero-fuss installation, cross compilation, and more.
Find a file
Stephen Gutekanst cc4595eb37 glfw: improve panic message for glfw.getInstanceProcAddress
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
2021-10-29 17:13:21 -07:00
.github glfw: CI: update to latest Zig nightly 1444+e2a2e6c14 2021-10-29 12:31:28 -07:00
src glfw: improve panic message for glfw.getInstanceProcAddress 2021-10-29 17:13:21 -07:00
upstream glfw: cleanup vulkan_headers 2021-10-24 05:20:30 -07:00
.gitattributes initialize repository 2021-07-04 10:36:34 -07:00
.gitignore gitignore: update to latest from ziglang/zig repo 2021-07-06 20:51:19 -07:00
build.zig glfw: workaround framework dependency inclusion bug for now 2021-10-29 12:31:28 -07:00
LICENSE LICENSE: note directories with a separate LICENSE file 2021-07-05 12:46:20 -07:00
LICENSE-APACHE initialize repository 2021-07-04 10:36:34 -07:00
LICENSE-MIT initialize repository 2021-07-04 10:36:34 -07:00
README.md glfw: correct CI status badge in README 2021-10-24 08:53:59 -07:00
update-upstream.sh glfw: cleanup vulkan_headers 2021-10-24 05:20:30 -07:00

mach/glfw - Ziggified GLFW bindings CI Hexops logo

Ziggified GLFW bindings that Mach engine uses, with 100% API coverage, zero-fuss installation, cross compilation, and more.

The main Mach repository includes this one as a git subtree. This is a separate repo so that anyone can use this library in their own project / engine if they like!

Zero fuss installation, cross compilation, and more

Just as with Mach, you get zero fuss installation & cross compilation using these GLFW bindings. only zig and git are needed to build from any OS and produce binaries for every OS. No system dependencies at all.

See also: platform support table

100% API coverage

These bindings recently achieved 100% API coverage of GLFW v3.3.4. Every function, type, etc. has been wrapped in a ziggified API.

What does a ziggified GLFW API offer?

You could just @cImport GLFW with Zig - the main reasons to use a ziggified wrapper though are because you get:

  • true and false booleans instead of c.GLFW_TRUE and c.GLFW_FALSE integers
  • Methods, so you can write e.g. window.hint instead of glfwWindowHint
  • Generics, so you can just use window.hint instead of glfwWindowHint, glfwWindowHintString, etc.
  • Enums, so you can write window.getKey(.escape) instead of c.glfwGetKey(window, c.GLFW_KEY_ESCAPE)
  • Slices instead of C pointers and lengths.
  • packed struct to represent bit masks, so you can interact with each bit the same way you'd interact with a bool if you like, instead of remembering the & | ^ incantation (although you're free to do that too.)

How do I use OpenGL, Vulkan, WebGPU, etc. with this?

You'll need to bring your own library for this. Some are:

Issues

Issues are tracked in the main Mach repository.

Contributing

Contributions are very welcome. Just send a PR to this repository.

We track the latest stable release of GLFW, if you need a newer version we can start a development branch / figure that out - just open an issue.

Once your PR is merged, if you're using Mach engine and wanting the changes there, it will be sync'd to the main repo via git subtree.