Hi, I'm working with raylib, without the zig bindings and I've come across a pain point. Essentially I want to be able to use array initialization syntax for c structs but the compiler complains about it not being supported. i.e this:
const rl = @cImport(@cInclude("raylib.h"));
// NOT OK
var camera = rl.Camera{
.position = .{4.0, 2.0, 0.0},
.target = .{0.0, 2.0, 0.0},
.up = .{0.0, 0.0, 0.0},
.fovy = 60.0,
.projection = rl.CAMERA_PERSPECTIVE,
};
// VERSUS WHAT IS OK
var camera = rl.Camera3D{
.position = .{.x = 4.0, .y = 2.0, .z = 0.0},
.target = .{.x = 0.0, .y = 2.0, .z = 0.0},
.up = .{.x = 0.0, .y = 1.0, .z = 0.0},
.fovy = 60.0,
.projection = rl.CAMERA_PERSPECTIVE,
};
Any way to circumvent this, or make it so that I don't have to specify each struct member individually? Its not a huge issue, but I'd rather not have to type .x, .y, or .z every time I need to initialize a vector for raylib.