Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/flyx/zargo
2D OpenGL drawing lib for zig
https://github.com/flyx/zargo
Last synced: 27 days ago
JSON representation
2D OpenGL drawing lib for zig
- Host: GitHub
- URL: https://github.com/flyx/zargo
- Owner: flyx
- License: mit
- Created: 2021-05-05T19:45:00.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-04-10T13:45:13.000Z (over 2 years ago)
- Last Synced: 2024-10-25T19:43:44.545Z (3 months ago)
- Language: C
- Size: 615 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: license.txt
Awesome Lists containing this project
README
# zargo
**zargo** is a zig library for 2D drawing using OpenGL.
It supports both desktop OpenGL and OpenGL ES.Simple usage:
```zig
// initialize engine
var e: zargo.Engine = undefined;
const backend = if (std.builtin.os.tag.isDarwin()) .ogl_32
else if (std.builtin.os.tag == .windows) .ogl43 else .ogles_20;
try e.init(backend, window_width, window_height, false);
defer e.close();// load some image into a texture
const tex = e.loadImage("test.png");
defer tex.free();// draw a red rectangle
e.fillRect(zargo.Rectangle{.x = 100, .y = 100, .width = 200, .height = 200},
[_]u8{255,0,0,255}, false);// draw the whole texture into a rectangle with the lower left corner at
// (500, 400)
tex.drawAll(&e, tex.area().move(500, 400), 255);
```zargo does not create a window or an OpenGL context for you. You can use
libraries like GLFW or SDL to do that. Be sure to tell the library to construct
the same version of the OpenGL context that you instruct the engine to use as
backend!## Building
Zargo depends on [libepoxy](https://github.com/anholt/libepoxy) via [zgl](https://github.com/ziglibs/zgl).
When building for Windows with GNU (i.e. MinGW) ABI, mind that you need to rename `libepoxy.dll.a` to `epoxy.lib` ([see here](https://github.com/ziglang/zig/issues/7799#issuecomment-761849308)).
## license
MIT