Hello! This is a Zig wrapper for SFML (CSFML), which is the Simple and Fast Media Library, a library for 2D graphics, windowing, input, sound and network.
https://github.com/Guigui220D/zig-sfml-wrapper
https://www.sfml-dev.org/index.php
The wrapper offers an object oriented layer to use SFML similarly to how you would in C++.
Here's a small example:
//! This is a translation of the c++ code the sfml website gives you to test if SFML works
//! for instance, in this page: https://www.sfml-dev.org/tutorials/2.5/start-vc.php
const sf = struct {
usingnamespace @import("sfml");
usingnamespace sf.graphics;
};
pub fn main() !void {
var window = try sf.RenderWindow.createDefault(.{ .x = 200, .y = 200 }, "SFML works!");
defer window.destroy();
var shape = try sf.CircleShape.create(100.0);
defer shape.destroy();
shape.setFillColor(sf.Color.Green);
while (window.isOpen()) {
while (window.pollEvent()) |event| {
if (event == .closed)
window.close();
}
window.clear(sf.Color.Black);
window.draw(shape, null);
window.display();
}
}