After this change: * `Core.pollEvents` returns an iterator. At the time of polling events, Mach core will perform work to poll for events, handle resizing of the framebuffer, etc. and the iterator allows the caller to consume all available events. * The event queue is now baced by a `std.fifo.LinearFifo`, which removes the need for dynamic allocation of each event. Instead, the event queue starts with a generous size suitable for most high-end gaming setups (high-precision mouse, etc.) and can grow, but never shrink, up to the maximum event queue size experienced by the app within any given frame. Effectively, this means we find the maximum capacity needed to store events and avoid runtime allocations. * `Core.hasEvent` is removed. Signed-off-by: Stephen Gutekanst <stephen@hexops.com> |
||
|---|---|---|
| .. | ||
| .github | ||
| libs | ||
| src | ||
| .gitattributes | ||
| .gitignore | ||
| build.zig | ||
| LICENSE | ||
| LICENSE-APACHE | ||
| LICENSE-MIT | ||
| README.md | ||
| sdk.zig | ||
mach/core: a modern alternative to SDL/etc
This repository is a separate copy of the same library in the main Mach repository, and is automatically kept in sync, so that anyone can use this library in their own project if they like!
Window+Input+GPU, nothing else.
mach/core provides the power of Vulkan, DirectX, Metal, and modern OpenGL in a single concise graphics API - by compiling Google Chrome's WebGPU implementation natively via Zig (no cmake/ninja/gn/etc) into a single static library.
Supports Windows, Linux, and macOS today. WebAssembly and Mobile will also be supported under the same API in the near future.
Learn more: https://machengine.org/docs/core
Getting started
Adding dependency
In a libs subdirectory of the root of your project:
git clone https://github.com/hexops/mach-core
Then in your build.zig add:
...
const core = @import("libs/mach-core/build.zig");
pub fn build(b: *Builder) void {
...
exe.addPackage(core.pkg);
core.link(b, exe, .{});
}
Join the community
Join the Mach community on Discord or Matrix to discuss this project, ask questions, get help, etc.
Issues
Issues are tracked in the main Mach repository.
Contributing
Contributions are very welcome. Pull requests must be sent to the main repository to avoid some complex merge conflicts we'd get by accepting contributions in both repositories. Once the changes are merged there, they'll get sync'd to this repository automatically.